If you are sure you have entered the code correctly you must have been sent the wrong code. DO NOT keep trying the same (wrong) code or you will lock the phone out forever!! I'd get back to O2 and request another code, using the unlocking form, and see if you get a different one back. What version of firmware do you have on the phone? You might be able to use an app off Play store if you root your phone.
S3 i9305 (4.4) EE 4G Samsung ATIV S 3UK Xperia SP O2 4G