iPhone back to OS3: What happens with application data?
Restoring firmware and restoring settings are two different things. You can restore to a stock version of the 3.1.3 firmware then when iTunes asks you to set up your device, you can select which settings image you want to back up from.

Or select the iPhone under "Devices" in iTunes >> right [or CTRL] click it >> Restore from Backup. Should work.