With the new Beta 4.0 release,I am sure a lot of people would have had this issue.
Shift + Upgrade Or Shift + Restore to the Beta 4.0 firmware caused itunes errors.
Here's what I did to get it working:
Download itunes 8.2
Shift + Upgrade | Uknown Error occurred
Shift + Restore | Unknown Error occurred
Resolution:
Restore your iPhone 3g to Beta 3.0
Shift + Restore (beta 4) | Worked.
Cheers