If you have an iphone 3gs which is dependant on a jailbreak for unlock and you have accidently restored it, then here is what you need to do,

The phone needs to be put into pwned DFU mode , this is easily done by downloading ireb for windows, or if you use mac, you can put your iphone into dfu mode via Redsnow

When putting your phone into dfu mode please follow the instructions on the software you download,

once your iphone is in Pwnd DFU mode then you can proceed to putting a custom firmware on your iphone via itunes.

 

When you download the custom firmware, save it to your desktop for easy access, then open itunes and before you select restore hold in the shift key (which will let you select which firmware you want to put on the phone) now press restore and search for the custom file on your desktop and select it and let the restore process finish.

when the update finishes all you will need to do is go into cydia , manage , sources, and install the ultrasnow repo which will reinstall your unlock