if u give it gentle throttle up to half and its okay, but falls flat on its face under full load, then goes again if u back off...
i work in a busy garage in the south of the uk, and 99% of the time this sort of behaviour appears when your Mass air flow sensor is giving faulty readings to the ECU.
also, when this happens it can throw up o2 sensor faults (because the car is running very lean). its quite common on a lot of injection cars, not specifically BMW's. had exactly the same thing on Fords, Vauxhall, Mercs etc.
very rarely does a MAF sensor actually bring up a MAF sensor fault, but personally that is where i would start.
EDIT: sorry forgot to mention, ON Bmw's it is also very common for the Intake hose to split between the MAF and the manifold, you dont see it, but when you floor it and the engine moves but the airbox is bolted to the car, the hose takes the movement and splits, causing a kangaroo behavior and bad idle, also lean running and o2 codes etc.
because the Air is entering the engine After the MAF sensor, it gives the ECU a false reading, and doesnt throw in nearly enough fuel, hence falling flat on its face...