it CAN be caused by a bad TPS but what your describing sounds more like a bad tranny controller or solenoid pack. Occasionally the shift linkage can be at fault. Most likely an electrical issue if it did work previously and it hadn't been getting abused before it broke.