The same just happened to me last week. In my case it is locked with Three and it is on the blacklist. When I bought the phone it was functional but just an hour or two later it had no service. So the scumbag who sold it to me must have just reported it stolen/lost to claim insurance OR maybe it could have been newly stolen (I bought it on a sell/buy website just after 4 hours of it being posted)... of course, it depends how quick the original owner was at reporting the stolen/lost phone.
I reported it to the police and they'll do their thing (either find out if it's indeed stolen or just a insurance scam) and from the outcome I'll either return it to the original owner (if it was stolen) or deal with the scumbag that is committing fraud with the insurance to get my money back.
If the police does not find anything (nobody reported it stolen/lost) and no claims are made for the phone, then I will ask them to provide me with a letter (or something) where they indicate that the phone is now mine as it had been properly reported and no one has claimed it.
If this is possible, then I would take this letter to Three and try to get them to put the phone under my name and release it from the blacklist.
Of course it is uncertain that I will either get that support letter from the police nor that Three will be accepting that, but it's my best shot from a "legal" perspective. Otherwise, if there is no solving at all, I'll just try to get it unlocked completely.