There is no other way than connecting in recovery mode to your computer, shown here iPhone and iPod touch: Unable to restore If you're lucky, your last backup does not contain the passcode and you will be able to restore your data and settings without a problem. Your contacts should also be part of the backup of your Mac, if you use Time Machine you can easily restore one of the older iphone backups. More info here: iPhone and iPod touch: About backups
If you cannot remember the passcode, you will need to restore your device using the computer with which you last synced it. This allows you to reset your passcode and resync the data from the device (or restore from a backup). If you restore on a different computer that was never synced with the device, you will be able to unlock the device for use and remove the passcode, but your data will not be present. Refer to Updating and restoring iPhone and iPod touch software.
If the issue continues after updating and restoring your device, refer to this document.