i phone 3g help???????????

hello everyone i am new here. i have a jailbroke unlocked 3g 8gb iphone carrier tmobile running on version 4.0.1 (8A306). how do i update to ios 5? what is the highest update i can do on this phone? if i update will it stay jailbroke and unlocked?
thanks

Answers