First thing I'd try is to get a new iPhone SIM (are they different?) from T-mobile and install that.
Just did a quick google and [url]found[/url] "If your iPhone is not Factory Unlocked (FU), but you are using unofficial SIM card in the iPhone, you will get this message after restore/update iPhone software, unless you either insert compatible sim cards...." at
http://iphoners.org/simcard-inserted-in ... supported/Sorry this is only a partial answer, but I'm all-factory-non-jaibroken and have never had to do what you want to do. Good luck...