I would guess air hoses. Check for leakes in them. Easy to find ther on the top of the engine usually. Route from the rear of MAF sensor, which should be attached if not VERY close to the airboxall the way back to the throotle body and into the engine. Look for wear or loose seals anything that might indicate a leak. My reasoning is you said it does run sometimes so I know your plugs are firing. so the wires are good and most likely your caps and rotor is good. So ignition is good. THis would leave intake and gas. More often than not its an intake issue. Not much I know but thats how these things go. You might consider saving the 80 bucks and taking it in. If you knew anyone with the same BMW you could swap the box, MAF and Throttle body and rule this out. Wish i could help more.