My car did the same thing,
It ended up being my valve cover gasket.
Took it to BMW got it replaced plus the intake cleaned with the walnuts.
Three days after I got it back I'm merging onto the a highway I hit about 4000 rpm in 3rd and the car goes into limp mode.
Turns out after they replaced the gasket the "trained technicians" over tightened one of the bolts for the valve cover and a 2 inch crack formed right beside the bolt.
FYI- 2 weeks before I discoverd the leak i had it in for an oil change, I guess they missed that one
Gotta love BMW
Take a good look around the engine for oil and look at the plastic cover that sits under the engine, If its not the problem you only wasted 5 mins if it is you may have saved alot of headache