If your SHSH hashes for your iPhone have been logged to Cydia, you can upgrade your iPhone firmware to 3.1.2 with a bit of hacking.
Check to make sure that your SHSH files are logged with Cydia
If this is the case, you are in luck and should be able to upgrade you iPhone.
Download the iPhone 3.1.2 firmware from http://www.felixbruns.de/iPod/firmware/
Edit your hosts file (usually located in C:\Windows\System32\drivers\etc\hosts) using notepad and add the following line to the bottom of the file.
This fools iTunes into pointing to the Cydia servers for the verification codes to confirm that the 3.1.2 firmware is allowed to be applied to your iPhone.
Make sure your iPhone is fully charged (this reduces the risk of it turning off mid upgrade), plug it into your PC and fire up iTunes
Once connected, in iTunes, click on your iPhone in the side bar Shift+Click on restore and browse to the 3.1.2 firmware that you downloaded.
Click OK and wait for iTunes to go through its motions.
Once complete your iPhone will reboot and you will be given the option to restore your files and settings from a backup.
Choose your backup and then click continue.
iTunes will now restore your files and settings to your iPhone.
Make a cup of tea or something whilst waiting…
Download your Jailbreak of choice. I use blackra1n – http://blackra1n.com/
Jailbreak your iPhone following the instructions of the jailbreak program. For blackra1n, just launch the program and click “make it ra1n”
iPhone Firmwares – http://www.felixbruns.de/iPod/firmware/
Blackra1n – http://blackra1n.com/
Pwnage Tool – http://blog.iphone-dev.org/