Try this:
1- Remove SIM, SD card and battery.
2- Leave battery out for 1 minute.
3- Put battery back and power up while holding the END and the BACK keys together
4- Wait for few minutes (The Tmobile Stick together window will appear frozen but the phone will finally power up)
5- Back up your SD card and reformat it
6- Back up your phone stuff (use Samsung PC suite from the Samsung web site)
7- Do a Master Reset on your phone (if you don't do that, even with a reformatted SD card, your phone may freeze)
8- Put your SIM and SD cards back and restore your backed up stuff