You may need to unlock the phone before it can be used with an O2 SIM card. Despite using the same network, a phone locked to a virtual network will not work with a SIM card from the network it runs off.
It should work the other way around though, so an O2-locked phone will work with a Tesco SIM card, or a T-Mobile-locked phone will work with a Virgin Mobile SIM card.
I've never actually tried it before, but this is what I've heard from other members on here.
Hope this helps.