Corbyn was relentlessly cheerful. He favoured ill-fitting suits over make-overs, hope over misery, authenticity over spin. It was a rejection of colourless, risk-averse managerialism that has made voters question whether Labour stands for anything at all.
Theresa May's mantra of "strong and stable" leadership emphasised exactly the wrong qualities for these voters. Wags began to call the prime minister "Maybot". Then she backtracked on manifesto promises - especially a form of asset-testing the elderly in long-term care. She couldn't cost her policies, refused to debate Corbyn on TV, and looked awkward in interviews. Maybot became "Maybe Not".
The Conservatives made a seismic miscalculation about their message and where to target it. Predictions that Brexit-voting working class voters would abandon Labour turned out to be wrong. Voters who deserted to UKIP two years ago mostly returned to Labour or Conservative roots, prompting one commentator to ask, "Are UKIP voters still racists if they vote for your party?"
Two months ago experts believed the campaign would be dominated by Brexit. It turned out that Europe hardly got a mention.
The people I went to school with, in a largely working-class area that voted Brexit, liked Labour's anti-austerity message but spontaneously talked about their reservations - seeing Labour as a party of virtue-signallers, university socialists, and Putin apologists.
I heard them repeat tabloid lines about his past "support" for the IRA, although others responded to newspaper attacks by sticking it to Fake News. UK newspapers could not have thrown more support behind the Conservatives and were confounded. No one will be frightened of them again.
And yet the outcome in seats is essentially the same as the result in 2010, when Gordon Brown lost office and took Labour to an historic low-vote share: The Tories still won the most votes this year. Labour still isn't in government.
Labour probably should have won. A few months ago I never believed that was possible. Even his own team began the campaign preparing for heavy defeat. Corbyn looked a shambles, his ideas out of step with voters, his political management inept.
What I was wrong about was the appeal of his unorthodoxy. In contrast to Hillary Clinton's campaign in the US last year (and perhaps similarly to President Trump's campaign), working-class UK voters were attracted to leadership that conveyed, "I hold my views so sincerely that I am prepared to go down to defeat if you don't agree."
Frustrated voters prefer candidates who are prepared to lose, rather than leaders who sandpaper the edges off flexible views in order to win at all costs.
In the UK they want to end failed austerity policies that have destroyed public services and damaged the British economy. Britain was also broken two years ago, when the Conservatives increased their vote. What changed this time was a Tory campaign of historic uselessness.
The parallels with New Zealand are limited because, here, far more voters are inclined to say the country is on the right track. But it's fair to say that if Corbyn had unified Labour before this election, Labour would be the government there now.
That's not the kind of unity that stifles dissent, but unity that is earned through it, where diversity of ideas is encouraged as much as diversity.
In the pursuit of political purity, talented and appealing centrists MPs (some of whom massively increased their vote share on election night) had been sent to the back benches or retreated there. They need to come back into the shadow cabinet, and be welcomed when they do.
Labour could unite now in a way it hasn't been able to since the early Blair years.
I expect the Conservatives to struggle, having lost moral authority to lead, ideologically unable to respond to the public mood, and overwhelmed by the complexity of Brexit negotiations.
The next election could be Labour's to win.
Josie Pagani is a centre-left political commentator and former New Zealand Labour Party candidate.