Well this is my experience with my M40 engine:-
My AFM gave problem years back and with nuts MACH guessing work I ended up spending thousands till most in my engine compartment are new till the exhaust centre box was change too.
Change my wiring plugs cable, coil, something under the trottle cable,(apa nama tak tau sorry) distributor set, and some other electrical cables that I am not familiar with. all change new no second hand.
My problem as I speed along the Highway daily KL-Sban I run normal say 110 then try to overtake the car refuse to go sangkut2, Cuntcil makan like nothing malu lah. Went to a few socall sifus with diffrerent answers one even service my AFM but young boys same age as my son still makes no different, suffered can say few years till about a year and a half back can'nt stand any longer bought a brand new AFM change it then thats the fault if you speed and the car malu to speed make alot of difference. After knowing BMW Club sifus then came to know that the AFM is serviceble, never mind got new no regrets, sayang left mine at the w/shop.
Another experience after a new AFM fix, got to be careful when taking out the rubber bellow from the trottle area to the AFM, very sensitif if you have a tiny hole your car will jurk at low speed or crawling Q. Had that happen after I fix mine, went to the w/shop they also can'nt trace it (with computer checking also can'nt trace (got to see the boys work) chincai2 rough habis lah our car) I trace it myself at last when I was doing something to my engine compartment, I open my air filter saw the crecks, seal it with 2ton glue the car run smooth yet I go back to the w/shop and teach them to be careful when dealing witn that. they say yah kah.
My habit is the engine must be always clean then any fault you can see clear and w/shop ada malu sikit buat kotor to our engine.
Well that is my tips that I have gone through if yours clicks check out the 2 types of my experience. (Sorry I am not technically expert as Fabianyee, Kevter, 535i and others) but I will let others know what I have gone through and learn the mistakes. best of luck and I still love my M40 & keep it even I go for another Bimmer later.