Official answer: no, O2 have the monopoly, and you need to pay the contract for use.
Unofficial (worked in America so far, will work in UK too): you can find iPhone unlocking websites (google those words) that have either software or hardware systems to change the firmware of the iPhone, removing the lock etc. Beware though, this isn't supported by Apple (obviously). If you have any issues with it, or if the process goes wrong, you've just bought yourself an expensive and not very good brick. Also, Apple will be periodically updating the software on the iPhone. This may well not work with your hacked iPhone, and if you try it it may "brick" it (turn it into a brick, but not Apple's fault).
Possible alternative: I've yet to hear of too many people doing this, but due to French law and a court case in Germany, you can pick up unlocked iPhones (properly unlocked, by T-Mobile Germany or Orange France), for an increased price. However, this increased price doesn't seem to be too different to buying a phone from O2 and paying the contract all in one go.