I might be wrong, but it is a simple attempted fix at least. The TPS sensor relays information on how far open the throttle is, if it isn't relaying that back to the PCM properly, it can cause impropper shifting. TPS works on a resistance value... if the is a break in the winding, you can skip point, going to WOT causes the tranny to down shift back to where you want it. Try replacing the TPS sensor, and see what happens.
Also how do you know it is going into 4th gear, if it isn't this could be a totally different issue...?