I got my iPhone 3G as a free upgrade after the 18 month contract on my original iPhone 2G ran out - all I had to do was sign up for a further 18 months contract to get the 3G , this was after the 3GS had come out .
I have no doubt that in a further 18 months , there will be an even newer iPhone and at that point I will be able to extend my contract yet again and get another 'free' upgrade .
I could have had a 3GS by paying a lump sum as well as extending the contract , but since i only wanted to add the GPS feature , I saw no need .
Another tactic , if you have an existing contract with O2 , is to threaten to leave . A friend , who had been with them a while , did this recently because he had seen something else from another supplier ( can't remember what ) and one of the things they offered him to try to persuade him to stay was - a free iPhone ! He left anyway .