I had this problem and solved it this way... I'm on a Mac, so I begin by referencing a Mac directory. If you are a Windows user, I include an alternate "Step 1" below as well.
Step 1 for Mac users) Navigate to the folder ~Library/iTunes/Device Support ...
For the new Mac users among us, remember that the "~" designates that you start in your home (i.e., yourname) folder on your Mac rather than the several other places where a "Library" folder exists.
Alternate Step 1 for Windows users) Navigate to this subdirectory:
C:\Documents and Settings\All Users\Application Data\Apple Computer\iTunes\
Step 2) Delete this file: x12220000_4_Recovery.ipsw
Step 3) Run the PwnageTool application. (I used PwnageTool 2.0.2 on the Mac.) Yes, I already had a usable custom firmware file I had made before, but I was doing it again because the process also dutifully recreates the file I deleted in Step 2 when it can't find it there.
Step 4) This is important: In my case, when Pwnage asked me at the end whether I had ever pwn'd my iPhone before (whether I'd seen the pineapple, etc.), rather than click "YES," I clicked "NO." In other words,
click "NO" as if this was the first time you've pwn'd your phone.
Step 5) Finish out the pwn'ing by following the prompts in PwnageTool to put your phone in recovery mode, etc.. Then within iTunes, option-restore with the new custom firmware you created.
Voila. The phone restored without the dreaded error. I hope this works for you as well. (Fingers crossed...)
Randy
P.S. Click the thanks button if this helped somebody. Makes me feel like life is worth living after all.