Hi sure you can use t-mobile sim in the new phone only if it is unlocked one else if the phone is locked to network provider other than t-mobile then you can't use t-mobile sim in it until you unlock it .You can easily unlock your phone using sites like
MobileUnlockSolutions.com they are rendering unlock code for all mobile models at reliable cost .You first check that whether the code is available for your mobile model ,country and network provider .If yes then pay for it and unlock your phone .