The military clique which seized power nearly five years ago had spent that time crafting a constitution and electoral system specifically to ensure its influence extended over future governments regardless of the outcome of the election.
It also did this to minimise the seats that could be won by parties allied to its nemesis – former prime minister Thaksin Shinawatra, who now lives in exile.
Those parties included a new one, Thai Raksa Chart, which was established in November last year with the aim of getting around the ceiling on party list seats that can be won, a ceiling that in particular affects the main pro-Thaksin party Pheu Thai.
Everyone knew Thai Raksa Chart was just another vehicle for Mr Thaksin and his allies to try to break the shackles put on them by the new constitution.
The real question hanging over this, the first election in eight years, was whether the pro-Thaksin parties would do well enough to form a government, and what the military could do to stop them.
The stunning announcement that Princess Ubolratana, elder sister of King Maha Vajiralongkorn, was Thai Raksa Chart’s sole candidate for prime minister changed everyone’s calculations in an instant.
The party was exploiting a clause inserted by the military into the constitution to allow for an unelected prime minister, a device to allow coup-leader Prayuth Chan-ocha to stay in office.
It calculated that this could also apply to an unelected princess, who now describes herself as a commoner, having given up her titles when she married an American 46 years ago.
But in Thailand she is still treated like royalty. How would it even work, to have a royal, by custom beyond criticism, take part in competitive democratic politics?
And surely, it was assumed, she must have had the king’s approval for such an unprecedented move – which then suggested he was aligning himself with Mr Thaksin, often accused of being anti-monarchy, against the ultra-royalist military and their allies.
Such a scenario radically altered the power dynamics in Thailand.
Within hours the king put a stop to this manoeuvre, issuing a royal decree stating that Princess Ubolratana was still treated as a high-ranking member of the royal family, and involving her in politics was “highly inappropriate”.
To be on the receiving end of such explicit royal disapproval would normally be a devastating blow in Thailand. By Saturday there were rumours the executive board of Thai Raksa Chart would be detained, though these were unfounded.
By Monday her nomination had been declared invalid by the Election Commission, which is now set to ask the Constitutional Court to consider dissolving the party.
If this is done before 9 May, the deadline for certifying victorious MPs, Thai Raksa Chart and its politicians will be eliminated from the election.
A reckless gamble?
With its demise, Mr Thaksin’s hopes of his parties forming the next government would be dashed.
On its own, under the new electoral system, Pheu Thai has no hope of repeating its success in the 2011 election of winning an outright majority of seats in the lower house of parliament.
The 250-seat upper house, or senate, is entirely appointed, its members nearly all expected to vote for Gen Prayuth to remain in office after the election. Had Princess Ubolratana remained a candidate, some, maybe most senators might have switched their loyalty to her.
Royalism has become embedded in Thai society as a quasi-state religion.
Everyone is required to show fulsome loyalty to the monarchy, whatever their private beliefs, and many Thais feel an intense emotional bond to it.
The perceived virtues of the late King Bhumibol – modest, capable, conscientious – were a constant popular reference during his long reign to show up the venality and incompetence of ordinary politicians.
It is a mantra of the royalist creed, and a preamble of every Thai constitution, that the royal family is kept above politics, beyond criticism.
So what was Mr Thaksin thinking, involving the king’s elder sister in his party?
People close to the former prime minister have let it be known that he had a green light from King Vajiralongkorn, and that the king was persuaded, perhaps by pressure from other family members, to change his mind.
But others inside the pro-Thaksin camp believe he simply assumed Princess Ubolratana had her brother’s approval, and took a reckless gamble.
He has form; his decision to push for a controversial amnesty in 2013, that would have allowed him to return to Thailand, backfired and started the protest movement that led to the 2014 coup.
And while some supporters of Thai Raksa Chart and Pheu Thai were excited by the prospect of having a royal celebrity on their side, others criticised it as inconsistent with their long campaign for greater democracy and equality in Thailand.
Reigniting old rivalries
The row over the princess has reignited old rivalries.
Royalists have come out to accuse Mr Thaksin of once again trying to exploit the monarchy for his own ambitions.
Frustrated supporters of the pro-Thaksin camp, who have been waiting for five years to demonstrate their voting power, fear their side will be tarnished once again as a threat to the monarchy, in order to keep a military-dominated government in power.
This is now bound to be a more heated election campaign.
It has also brought into sharp relief some realities of modern Thai politics.
One is that more than 10 years after he fled from Thailand, Mr Thaksin is still a powerful influence on the political dynamics of this country.
Two military coups, repeated court cases, the confiscation of his assets and years of demonisation have not finished him off.
His parties remain the country’s most effective electoral force. In the present climate it is difficult to imagine a reconciliation with his many adversaries, but without one it is hard to see how Thailand can ever move on.
Another is the central role of the monarchy.
Because of the strict taboos and laws against any critical comment, no journalist writing from Thailand can write freely about this, but some aspects of King Vajiralongkorn’s new reign can be mentioned.
He is a more hands-on manager of palace affairs than his father, and is overseeing the biggest overhaul of the monarchy in decades.
He has taken direct control of the Crown Property Bureau, the wealthiest collection of assets in Thailand, and is overseeing significant changes in the command structure of the armed forces.
He has demanded changes to the constitution where they affect the authority of the monarch, and got them.
He is taking back control of large properties in the old royal quarter of Bangkok hitherto used by the National Museum, the parliament and the city’s zoo.
It is not clear yet what kind of monarchy he has in mind, but in a country where no-one can be seen to question the king’s wishes, he will have a decisive say in the affairs of the nation, and his rule will be very different from his father’s.
We may never know what transpired between the king, his sister and Mr Thaksin over this extraordinary episode.
But we do know that the king’s carefully-written statement on Friday night brought it to an immediate halt, and that everyone in Thailand will now be looking to the palace before considering their next steps.