hi
Put in dfu mode and try to restore 3.1.2 or 3.1.3
to put in dfu mode you have to conect your phone with itune make sure the phone shoud be on then switch off the phone while its conected ( do not disconenct from pc )
1 : press power on for 3 sec
2 : as soon as you see the apple sign hold the home button as well as the power button for 10 sec.
3 : when screen gose blank after 10 sec relese the power button but keep holding home button till the time you see the messege appears on your computer screen.
once your phone go in dfu mode keep hold shift key on your keybord and click restore and then chose the firmware 3.1.2 or 3.1.3 ( which you can download from iclearified.com)
if that helps say thanks