How can I erase the history of passcodes on the iPhone4?
Many times password policies like this are enforced by looking at the most recent N passwords. For example, if a company requires changing your password every month, they may look at the last 12 passwords. I can't say for sure how it is implemented with the iPhone.

A simple trick to get around this is to change your password N times so that the password you want gets knocked off the list and you can use it again. If you don't know what the rule is and how many recent passwords are stored, it may take some trial and error.