Really you need to have a complete systems scan, I have worked on a lot of BMW and I have yet to see a Trans Sensor cause these issues and idling problems. You need to have a good Diagnostic Tech look this problem over. By the way your car has over 40 CPUs, many of them are 32 bit systems and you have at least 3 networking protocols, so a network/data bus error can cause all the problems you have. I just dealt with one on Weds that had very similar symptoms as your car and it was a network data bus error caused by heavy rain. Once I fixed the data bus, all was fine and the trans worked perfectly again.