The Dev-Team has finally released the complete jailbreaking and unlocking solution for iPhone 3GS. The JUST released redsn0w (version 0.8) is now available for all the platforms. This includes Windows, Mac OS X and Linux.
redsn0w is a easy to use, multi-platform, multi-device jailbreaking and unlocking tool for the iPhone 2G (original iPhone), the iPhone 3G/3GS and also the iPod touch(1st generation and second generation). Currently it is available for Windows, Mac OS X and Linux.
The steps to jailbreak and unlock for iPhone 3GS are exactly same as for iPhone 3G. Just follow the step by step guide here to first jailbreak your iPhone 3GS with redsn0w 0.8 (download link given below) and then unlock it through ultrasn0w 0.8 from Cydia.
Download redsn0w 0.8 for Windows
Download redn0w 0.8 for Mac OS X
Download redsn0w 0.8 for Linux