It's not fair but stability is traditionally seen as being more important, therefore the sitting PM as an individual has the chance to get his party and any other parties behind him. This is not a 'Labour' win, this is continuity of the PM. If the Tories supported GB (never going to happen but if...) then we would have a Lab/Tory coalition with GB as PM even though Tories got the most votes and would be the bigger party in the coalition.
If GB can retain the confidence of the House of Commons and have enough support to get his legislation passed (327 seats agreeing with him) then he gets to stay.
DC got more votes than him but he doesn't have enough to make sure his legislation is passed. One could argue the 'will of the electorate' was not to have a Tory Govt cos they didn't get a majority, so a Lib/Lab coalition headed by GB as the sitting PM would be more representative.
If you do some sticky electoral maths neither side can do it on their own with their traditional allies. The Lib Dems HAVE to decide it.
GB is PM until he resigns. He will resign if/when he loses the confidence of the Commons. ONLY once that has happened can the Queen invite someone else to form a Government.
Basically the problem here is that GB hasn't resigned because he thinks he has a fighting chance to form an anti-Tory alliance.