It doesn't surprise me that TMobile would 'terminate' your warranty when you end your contract with them, it seems pretty typical of the terrible service offered by wireless phone companies in the US.
I'm not sure where you live, but in the state of California, a manufacturer is REQUIRED to honor the warranty of their product. The termination of your contract has nothing to do with your device. Even if it is written in your contract with Tmobile, I would still take this up with them. Working in the customer service side of business, I am sure if you flail your arms around enough and ask to talk to enough 'bosses', they will take care of you.
Best of luck.
"Once you go BLACK (berry) you'll never go back"