The best way is to take your girlfriend with you to UK and you guys get married and then when you fill up your forms, don;t lie just tell them that you over stayed, because of your mrs. and you didn;t wanted to leave her, thats why you guys got married. I reckon this will solve your problem. Like others stated here that for temp visas you cant apply for permanent you can at any time. ( To make everything 100 % sure Please go to Immi expert as they will tell you how to start the process in a proper way, so that there are no loop holes in your story) Also be honest with your lawyer as he is the one you can count on.
Cheers.