Hi ,erratic idle on e36 318is is a very common problem normally down to either icv, air leak after the maf meter or just general caron and gunk build up.
When i had this problem I remove the air filter cover and with the engine running slowly sprayed carburettor cleaner into the maf unit in short bursts.
I also replaced the rubber boot between the maf meter and the throttle body this can leak even if it looks ok (give the throttle body a spray while youve got the rubber elbow off). Finally check all vacuum pipes and clips especially the ones from the icv. Hope this helps ,oh just out of interest to get 2.1 litre out of a m42 engine you need a spacer plate to raise the capcity ac schnitzer used to do theese but they are very rare/ expensive. The ac schnitzer 2.1 engines produce 180 bhp this was with a tuned chip and big bore throttle body as well though. Supercharging produces similar power output and its an easy diy job
take care Cozmic