Hi,
I don't have a 100% answer, but thought I'll give you some ideas that could solve your problem and that had helped me many times in my shop.
Check all parts of the air intake, must have no leaks "period". After the MAF replacement adaptations need to be reset. You can use Launch scan tool, which is very powerful on BMWs or any other software available for BMW's.
ASE Certified Technician
Over 13 years of experience in automotive field. Transmission shop owner / Transmission rebuilder.