1 - You have already upgraded to iOS 4 using the iTunes upgrade or restore process. Meaning you have upgraded to iOS 4 without using a customized iOS 4 ipsw using Pwnage Tool for Mac (for example)
2 - Your 3GS is Jailbroken using Spirit previously. If you are this stage, you need to wait for Geohot to release the new Spirit for iOS 4.
3 - The 3GS have the NEW Bootrom. Regardless whether you have already jailbreak or not, there is NO solution for the new Bootrom 3GS. Need to wait for any hackers to release a new Jailbreak.
As mentioned by the Dev-Team:
Summary: Currently, PwnageTool only works on previously jailbroken 3GS devices with the old bootrom.
If you have a Jailbroken iPhone 3GS with the OLD BOOTROM and you DID NOT use Spirit to jailbreak then you can create the ipsw with PwnageTool 4.0 and restore with your jailbroken recovery mode.
If you have an iPhone 3GS with the NEW BOOTROM this is NOT supported by PwnageTool 4.0 PwnageTool 4.01