as much information as you provided...need more. :-) Inducing from what you wrote...sounds like you have a V8 car with the common oil leak....either a 3.0 or 4.0 liter...gonna presume a 530i since most 540i owners would say...how am I doing?
Engine management on V8 cars has coil packs. These coil packs can sometimes short out causing errant codes due to oil leaking around the spark plug holes...oil is a conductor as are most fluids...albeit not the best conductor but good enough with very high voltage. You need to address your oil leak if you want decent performance. A suggestion is give a full blown description of where the oil is emanating from and precisely what procedure you employed on replacing your parts/gaskets. Again, what you describe is quite common for V8 cars and can be resolved. If you want to stay away from the dealer which I strongly recommend, invest in a Bentley manual which will I.D. your fault code...I don't have mine with me to tell you what that code is. Don't suffer the pitfall of trading your Bimmer in...sell it to some one on the board and make a bit more money in the process. Low miles E-34's are desireable cars...more or less depending on which V8 block aluminum alloy you have.
Good Luck.