DO NOT pay for any 'commercial' unlocking software. All unlock software has always been free, and at best, someone is trying to sell you what is available for free, and at worst, it won't work and you'll never get your money back.
You will need to know three things about your iPhone to unlock: The exact model: 3G, 3GS, etc. The exact OS: 3.0, 3.12, 4.1, etc. The baseband version number, found under the Settings and About buttons.
Good information about how to unlock for each version of phone, baseband, and OS can be found at the links below. You will first need to 'jailbreak' in order to load up the unlock software.
http://www.redmondpie.com/unlock-iphone-3.1.3-3g-3gs-with-ultrasn0w/ (also search related articles if this isn't exactly your model).
http://modmyi.com/guides/how-unlock-iphone-3gs-3g-4-0-firmware/And a website from the guys actually doing the breaking software.
http://blog.iphone-dev.org/I have only jailbroken my phone as it is illegal in Singapore to lock a phone to a carrier. Read plenty about it. Joint the forums at modmyi and ask questions. You should be able to do it yourself and a bit of study, and it is possible to set up your own restore package to put the phone back the way it was in case something goes wrong.
PS: In the US, T-Mobile only offers Edge data (2G). Their 3G system does not work with iPhone.