About aftermarket intakes, which are most of them with the exception of ECIS system and perhaps one or two others, they all do not have a provision to incorporate something known as the "MAF Screen", which is on the stock Intake system. This screen prevents turbulent or tumbling air coming across the sensor, from what I understand. It has been well documented that M3s that do not have this screen installed will on occasion upon engine deceleration, an idle stumble will occur, then the injection system may correct the stumble in time, but if not, the engine shuts-off. In my readings, some M3s were affected by being screen free but others reported this idle stumble upon deceleration, so it seems to be a hit or miss matter.
Just Google "MAF Screen" and you will see plenty of old posts on the matter. Try carefully removing the screen from your stock intake and incorporate it into whatever intake is on your M3 now. This screen, is not available for separate purchase from the dealer; it is part of the whole induction system, located ahead/up stream of the MAF. This is the first step to diagnosing your engine shut-off issue.