1222 means it's running rich/lean; 1221 means the ECU is not receiving a signal from the oxygen sensor.
You did the right thing by replacing the sensor, but you need to go and double check and make sure it's actually sending a signal (especially if you used a universal Bosch with the original harness -- they are not meant to be soldered, use the crimp connectors supplied; also the Bosch makes OEM sensors for BMW ... the only difference between a universal Bosch and OEM is the harness/connector).
Second thing: The reason the code disappears when you floor it is that the ECU goes into open-loop under WOT and doesn't care about the reading from the oxygen sensor; same when the car is cold (so if you were to start driving as soon as you started it cold, you probably wouldn't get the CEL until it warmed up).
Also, the way you clear the CEL is not disconnecting the battery: instead you do the stomp test and then when it starts to flash, you depress the gas pedal for 10 seconds.
As far as your TPS, it's fine. If you are able to perform the stomp test, that means it works/sending a signal at WOT (that's actually what sends the signal to the ECU to let you into diagnostic/stomp test mode).
Lastly, it doesn't matter if the car is warm or cold for the stomp test -- you can get into it at any time. The problem is getting the timing just right; you gotta start stomping as soon as you turn the key ... it's taken me as many as 15 times to get through before.
Hope that helps; I know it's a lengthy post...