Options for when an iOS device gets locked because of forgotten passcode:
Restore (and reset passcode) on your device by connecting it to the last computer to which it was connected:
iTunes: Backing up, updating, and restoring iOS software - http://support.apple.com/kb/HT1414
If you cannot connect it to the computer to which the device was last connected (or the device was never connected to a computer) you will have to use recovery mode to completely reset the device, losing all data:
iOS: Unable to update or restore - http://support.apple.com/kb/HT1808 - recovery mode (e.g., cannot connect to computer last used to sync device, iTunes still asks for a password)