How can I unlock the iPhone when I've forgotten my passcode?

You can't.

The entire purpose of the lock code is to keep the iPhone from being accessed by someone who doesn't know the code. Unfortunately, that's you.

In order to start using your iPhone again, you'll need to restore the phone via iTunes. You'll lose any data that's new on your iPhone since your most recent sync.