I had to replace my tps on my e34. My problem was the trans would go into failsafe mode, which means it stays in 3rd gear. If you get a dealership to read out the fault codes, it will say on the screen, "TPS sensor calibration" or something like that.
I believe BMW sells them for around $120 or so.
Not the easyest to change, there mounted on the side of the throttel body and usually the screws are corroded in there. A 90* philips screw driver or a #2 with a very small handle will work.