I downloaded the iOS 5 .ipsw file from a direct link. You can find the one that matches your device type from here.
After the download completed, I followed standard instructions like hold ‘Option’ while I click the ‘Update’ button in iTunes. Did that and selected the .ipsw, iTunes says, contacting itunes store and throws this error.

How I fixed this error on my Mac(Snow leopard).
- Move the iPhone3xxxxx_Restore.ipsw file to /Users/<yourusername>/Library/iTunes/iPhone Software Updates/
- Quit and reopen iTunes
- Click on your device and click ‘Update’
- Done.
This did the trick.
