The party percentage has no effect in a general election (and would only be officially discussed if there were a hung parliament and the Privy Council had to advise the Queen on who to appoint as her Prime Minister - this has happened before or if the result was so distorted it couldn't be ignored).
As I recall, the convention is that the parties should agree a candidate for Prime Minister before he/she goes to the Queen to be appointed. It's one of the major weaknesses of the UK constitution that the process isn't actually written down anywhere. I seem to remember that in theory, anyone can go to the Queen, and the Queen is also free to appoint whoever she pleases. It's part of the legal mythology that surrounds the powers of the monarch, I believe.
I think in practice, in the event of a hung parliament, the Queen would appoint the leader of the largest party Prime Minister. He/she would then face a vote of confidence in the House of Commons, and if they lost it, a new election would be called. On the other hand, if a viable coalition among losing parties could be agreed, then the Queen would appoint their candidate as PM instead. I suspect that if there was no viable coalition and no chance of the largest party winning a vote of confidence, then the Queen would appoint the leader of the largest party the PM just so he/she could lose the vote of confidence. Probably in practice, the parties would agree among themselves to let the leader of the largest party try and run a minority government, particularly since the success of the SNP minority government in Scotland in 2007-2011.
As far as I know, in electoral theory, it's never a good idea to be seen to bring down a parliament unless you're certain that the voters are on your side. That's unlikely straight after a general election, so political parties will normally come to some agreement to make sure that some government can be formed, even if it's a minority government.