i think if you restore the phone and have a clean firmware base it will pick spirit in no time....worked for me..make sure to auto save shsh..dont loose your baseband...if you are moving to 3.1.3..check thread on how to upgrade without changing base band.
you have a factory unlocked 3G iphone because if you look at carrier in the settings, you will see Carrier 5.1,and if it has been looked to any provider you should see the name of the provider will appear
For the old iPhone 3G I would first try blackra1n. Spirit is only for firmware 3.1.2 or 3.1.3. If you only get a tethered jailbreak (= need to jailbreak at every reboot) you can restore to firmware 3.1.3 without upgrading the baseband (see other thread how to) and then use Spirit.
guys spirit is working fiine on 3g 3gs....it dosent matter which firmware u are using...evryday i m doing 2 to 3 iphone jailbreaking some are 3gs and after jailbreak they are working fine..no problem...spirit is good