Here are the steps to do a force restore on the iPhone and reset the Passcode lock,
1. Make sure it is unplugged and Turned off
2. Hold the home button while plugging it into your computer. The iPhone should turn on once plugged into the computer.
3. Keep holding the Home button until the Connect to iTunes symbol appears on the iPhone
4. iTunes will say that it has found an iPhone in recovery mode and ask you to restore it.
5. Restore the iPhone by clicking "Restore" under the iPhone tab
6. When it is done with the restore, do NOT Restore this iPhone from a backup, instead Set it up as a "New iPhone"
7. If you dont want to sign it up with AT&T or you dont currently have an iPhone plan, instead of Setting it up a "New iPhone", close iTunes completely and then jailbreak, unlock, and activate the phone using a program called ZiPhone. You can get ZiPhone at "http://www.ziphone.org/"
8. Have fun with your new iPhone