From what I understand, you have to use Saurik's server (but only if you saved your SHSH/ECID in Cydia).
If you clicked the "Make my life easier!" button in Cydia, all of those things are saved.
You direct iTunes to Saurik's server instead of Apple's, and then use the stock 3.1.2 firmware to restore.
There are links on here somewhere, but I'm posting from my actual iPhone, so I don't have the link on me right this second.....