The preliminary results will be a crushing blow for the military and its allies. But with parliamentary rules on their side and influential figures behind them and involved behind the scenes, they could still have a role in government.
Prime Minister Prayuth Chan-ocha, a retired general who led the last coup, had campaigned on continuity after nine years in charge, warning a change in government could lead to conflict.
On Sunday, he slipped away quietly from his United Thai Nation party headquarters, where there were few supporters to be seen.
A handful of staff sat beside plates of uneaten food as a giant television screen showed a live speech by Move Forward's leader.
"I hope the country will be peaceful and prosper," Prayuth told reporters. "I respect democracy and the election. Thank you."
Pheu Thai had been expected to win having won most votes in every ballot since 2001, including two landslide victories. Three of its four governments have been ousted from office.
Founded by the polarising self-exiled tycoon Thaksin Shinawatra, Pheu Thai remains hugely popular among the working classes and was banking on being swept back to power in a landslide on nostalgia for its populist policies like cheap healthcare, micro-loans and generous farming subsidies.
Thaksin's daughter Paetongtarn, 36, has been tipped to follow in the footsteps of her father and of her aunt, Yingluck Shinawatra, and become prime minister. Yingluck and Thaksin were both overthrown in coups.
Paetongtarn said she was happy for Move Forward, but it was too soon to discuss alliances.
"The voice of the people is most important," she said.
Move Forward saw a late-stage rally in opinion polls and was betting on 3.3 million first-time voters getting behind its liberal agenda, including plans to weaken the military's political role and amend a strict law on royal insults that critics say is used to stifle dissent.
Thitinan Pongsudhirak, a political scientist at Chulalongkorn University, said Move Forward's surge demonstrated a major shift in Thai politics.
"Pheu Thai fought the wrong war. Pheu Thai fought the populism war that it already won," he said.
"Move Forward takes the game to the next level with institutional reform. That's the new battleground in Thai politics."