Well Friend!
There are few things to make sure it can be unlocked...
1) make sure it's 2G or 3G.
2) make sure it's running on 2.2(5G77) firmware verson.
3) make sure it's modem firmware is 02.28.00 TO SEE ALL THESE,
go to settings, after that go to general, then go to about, and there you'll see all these.
Now, If you have all these then you're gud to go...
First!!! You gonna have to jailbreak it with quickPWN 2.2 which you can download from it's website for free. Then you need download firmware verson 2.2 and save it on your hard drive. Once you have all these then you can start your iphone unlocking. Make sure that you follow all the directions correctly given at a time of jailbreaking. Once you're done with that, it'll say your phone is successfully jailbreak.
NOW: You're going to unlock your iphone with cydia which you'll see in there.Then you gonna have to add this source to your cydia...(http://apt9.yellowsn0w.com) be very careful with the source. to add this sourse you have to go to CYDIA, then go to MANAGE, then go to SOURCES. then EDIT, after that go to ADD, and then enter the source from above. And follow the instruction it says. once you're done do POWER OFF. Now put your t-mobile sim card in and then restart it again and after few seconds you'll see t-mobile on top of your iphone and that's it, you're DONE.
BE VERY CAREFUL WHEN YOU DO ALL THESE, AND DO IT ON YOUR OWN RISKKK...but again it's not that hard, just do what I told you, you'll be fine
OK Friend
Gud Luck!!!!!!!!!
let me know if you need any help.....