BMWs are very sensitive to vacuum leaks so check the obvious. Borrow a vacuum gauge from autozone and look for at least 14hg of vacuum. If not check for leaks. If you get decent vacuum you may need to check the idle control valve and on an 86 you have a control unit for that valve (below the dash somewhere,separate from the ECU) these are not cheap but are problematic and should be replaced as a set. An electrical component can work until it gets hot/warm then begin to fail more quickly as its use continues.