It’s been a while since iOS 4 jailbreaking tools made their way to jailbreak iPhone 3GS. Sadly, they were all restricted to old bootrom models of iPhone 3GS, iPhone 3G and iPod touch 2G (non-MC models). Moreover, iPhone 3GS devices had to have not just old bootrom, but were also required to have previously been pwned or jailbroken on anything (like blackra1n or Sn0wbreeze) other than Spirit.
Luckily, Spirit2Pwn patch has been released by Gojohnnyboi which can be used to perfectly restore your iPhone 3GS on iOS 4 custom firmware (from PwnageTool or Sn0wbreeze). This applies to iPhone 3GS with old bootrom, previously jailbroken on iPhone 3.1.3 using Spirit.
Note: There are conflicting reports that Spirit2Pwn is not developed by Gojonnyboi and is probably fake. But it seems to have worked for many users, so it is better you stay away from this patch until things are clear. In case you are one of those lion-hearted guys itching to get your hands on the tool, below is the step-by-step guide, courtesy RP.
[How to] Jailbreak iPhone 3GS on iOS 4 with Spirit2Pwn
1. Start Cydia on your iPhone 3GS (old bootrom, jailbroken on 3.1.3 using Spirit) and touch on “Manage” tab on the bottom. Now touch on “Sources” and then on “Edit”
2. Touch on “Add” and you will be prompted to enter a url source. Type “http://repo.woowiz.net” and touch on “Add Source”. Cydia will now automatically update your sources.
3. Once the repository is added, search for “Spirit2Pwn” in Cydia and install the application.
5. Once you have jailbroken your phone, you can unlock it using ultrasn0w 0.93 (on any baseband).