@PinguSpy I was really astonished someone smart like you getting scammed and prepared an angry reply, but after reading the whole thread, there is actually nothing to say. You have done your best and its definitely a pretty weird scenario. The main question, How much does his upwork profile worth? If less than the amount paid then your hands are cuffed as he is ready to lose his account for blackmailing you. I would never give anyone money unless his profile worth A LOT more than what I am paying.
If his account worth more which I think it's from the stats you mentioned, then, he thought he will get away with it and pushing through upwork should get things solved. Anyway, I believe you can find another programmer, but your focus should be getting you money back. So, contacting Upwork was the right step. Not sure if threatening him with legal action will make him step back or know how much you value the code and try to squeeze you more and more.
You are definitely in a hard situation , but look at the bright side, you are one of the brightest members I have ever seen in BHW, so, no matter what happens you will always have tons of other bigger and better ideas. It's only small part and not a total loss.
Keep us updated and good luck
He is definitly one of the brightest, as for this amount, yeah, it's not even close to make you richest in BHW