Flashing is for CDMA phones.If you have GSM network based phone means no need to flash your phone,Unlocking is enough for swap your network carrier to T-Mobile.To find to what network your phone is locked,
just go to settings----> General-----> Network and find which Network your phone is support. Other than that Network you have to unlock.For unlocking visit Mobile-Unlocker.com