You can delete the lib files so that itunes see a new phone and install apple firmware, or if you want to keep your jailbreak you'll need to download something like redsn0w etc... google jailbreak 4.1 3gs and see what you come up with this is one way.
to delete your files a better link for mac osx
Mac, Go to ~ / Library / iTunes /. In the Finder, you can choose Go> Go to Folder. Type or paste the path name above and click OK. - Delete all files in the iPhone Software Updates and Device Support. - Try to restore the iPhone again.
On Windows, these files are located in a hidden folder. To view these files in Windows Explorer, you must select Tools> Folder Options, click View, then select "Show hidden files and folders.
In Windows Vista, follow the instructions below: - Go to Start> Computer> Local Disk and type the following path: C: / users / [yourusername] / AppData / Roaming / Apple Computer / iTunes / - Delete all files in the iPhone Software Updates folder and Device Support. - Try to restore the iPhone again.
In Windows XP, follow the instructions below: - Choose Start> Run, then type C: / documents and settings / [yourusername] / Application Data / Apple Computer / iTunes / - Delete all files in the iPhone Software Updates and in Device Support.