iPhone works with AT&T. I restored iPhone to factory conditions using iTunes. Once the restore was complete, phone was automatically rebooted.
Once, it was back up I used blackra1n and installed that on the phone, once i had the app on the phone, i used wifi on the iPhone to install sn0w and unlocked my iPhone (wifi off, 3G off, data roaming off, and played around with these settings as well).
Now, when I insert T-Mobile SIM card, the phone can't find any service, however, if the same sim inserted in a different phone (or two) works just fine. Also, after this process AT&T sim card just works fine as well.
I hope I have provided all the details and hoping someone from this community is able to help.