Check the E-box for signs that it has had water in it. The E-box contains the Motronic control unit and the transmission control unit, if applicable. It is accessible from the right rear of the engine compartment by removing the trim panel on the firewall behind the tray where the diagnostic connector is attached. The Motronic control unit sits on the floor of the compartment, which can get water in it during a heavy rainstorm or when running the car through a car wash. If the Motronic control unit shows signs of having become wet, such as rust or corrosion on the case or connector, it must be replaced. There is an update from BMW for the drains on the air intake plenum for the climate control to help prevent this problem. A related document, TSB 41 03 93, is available. NOTE: Vehicles produced after 6/94 have an extra drain added to the air intake plenum, as shown in the factory TSB 41 03 93. Even with the update to improve drainage, it is possible for the drains to be plugged with debris, allowing the Motronic control unit to get wet under the above conditions, so this should be considered as a possibility for all E36 3- series vehicles.
ALso, your throttle body may be carboned up and need to be cleaned! This can cause all sorts of idle and hesitation problems. This is caused by the throttle plate not seating properly. The First thing i would do is clean out the throttle body with a small brush. Another common cause would be the Idle Air Control motor. It may be bad causing your condition. This is very common on older cars. The IAC motor gets lazy and cant keep up with the fast idle changes. Also when the IAC motor is out, I rec to check the passages for carbon build up. If they are plugged they need to be cleaned out.
The position of the IAC pintle affects engine start up and the idle characteristics of the vehicle. If the IAC pintle is open fully, too much air will be allowed into the manifold. This results in high idle speed, along with possible hard starting and a lean air/fuel ratio. If the IAC pintle is stuck closed, too little air will be allowed in the manifold. This results in a low idle speed, along with possible hard starting and a rich air/fuel ratio. If the IAC pintle is stuck part way open, the idle may be high or low and will not respond to changes in engine load.
Check for the following conditions:
Poor connection at PCM or IAC motor. Inspect harness connectors for backed out terminals, improper mating, broken locks, improperly formed or damaged terminals, and poor terminal to wire connection. Refer to Diagrams.
Damaged harness. Inspect the wiring harness for damage.
Restricted air intake system. Check for a possible collapsed air intake duct, restricted air filter element, or foreign objects blocking the air intake system.
Throttle body. Check for objects blocking the IAC passage or throttle bore, excessive deposits in the IAC passage and on the IAC pintle, and excessive deposits in the throttle bore and on the throttle plate. Check for a sticking throttle plate. Also inspect the IAC passage for deposits or objects which will not allow the IAC pintle to fully extend.
Vacuum leak. Check for a condition that causes a vacuum leak, such as disconnected or damaged hoses, leaks at EGR valve and EGR pipe to intake manifold, leaks at throttle body, faulty or incorrectly installed PCV valve, leaks at intake manifold brake booster hose disconnected, oil filler cap, oil level indicator loose or missing, etc..
Idle Speed Control (ISC) Motor -
A malfunctioning ISC motor can cause the engine to stall when shifted into drive or reverse. Verify that the idle speed control systems are working correctly.
Throttle Position Sensor (TPS) -
A malfunctioning TPS can cause the engine to stall when shifted into drive or reverse. Verify that the TPS is operating properly and that the calibration is correct.
Engine Vacuum -
Incorrect engine vacuum can cause the engine to stall when shifted into drive or reverse. Test the vacuum systems and the engine for vacuum leaks.
Fuel Pressure -
Incorrect fuel pressure can cause the engine to stall when shifted into drive or reverse. Verify the fuel system pressure is correct.
Mass Air Flow (MAF) Sensor -
A malfunctioning MAF sensor can cause the engine to stall when shifted into drive or reverse. Verify the MAF sensor calibration is correct.
Camshaft Position Sensor -
A malfunctioning CMP can cause the engine to stall when shifted into drive or reverse. Verify a proper signal is produced by the CMP.
Throttle Body -
A malfunctioning throttle body can cause the engine to stall when shifted into drive or reverse. Verify that the throttle body bore is clean.