Sounds like a vacuum leak. Easy way to tell is to listen for air moving around while its running (like a hissing sound). Or spray brake cleaner along the hoses while its running and wait for the engine to sputter, when it does, thats where the leak is.
Most of the time on BMWs the leak is on the intake boot that goes from the air filter to the throttle body (engine).