Substitute Ross Moriarty snatched a late winner as Wales floored 14-man France in a breathless World Cup quarter-final with echoes of their tense encounter in 2011 on Sunday.
A moment of madness cost France in Oita after lock Sebastien Vahaamahina was sent off for elbowing Aaron Wainwright nine minutes after half-time with his side leading by nine points.
Wales, paced by 10 points from fly-half Dan Biggar's perfect boot, face either South Africa or hosts Japan in the semi-finals next weekend after surviving a scare against the swashbuckling French.
Still haunted by the memory of a stinging 9-8 semi-final loss to France eight years ago, the Six Nations champions looked decidedly uncomfortable until Vahaamahina's rush of blood undid all of France's hard work.
Defeat also brought the curtain down on France coach Jacques Brunel's two-year spell in charge of the three-time World Cup finalists.
"I think the better team lost today, but that red card was obviously significant. The great thing about our boys is they don't give up," said Wales coach Warren Gatland.
"We just hung in there today and I'm really proud of the boys because lesser teams would have probably capitulated," he added.
Vahaamahina had stunned the Welsh by bundling over from a lineout after just five minutes before France scored one of the tries of the tournament.
Roared on by chants of "Allez, Les Bleus!" flanker Charles Ollivon stormed through to complete a sweeping move involving Virimi Vakatawa, Romain Ntamack and scrum-half Antoine Dupont.
Back came Wales in an electrifying opening 12 minutes as flanker Wainwright pounced on a loose ruck on halfway to race clear for his first Test try.
This is the reason France lock Sebastien Vahaamahina copped a red card. Could it be the game-changing moment? pic.twitter.com/aChk8I5Jj5— SA Rugby magazine (@SARugbymag) October 20, 2019
Biggar slotted a penalty to bring the Six Nations champions to within two points.
But when a high tackle from substitute Ross Moriarty on Gael Fickou resulted in a yellow card, France made Wales pay as Damian Penaud released Vakatawa to grab France's third try on the half-hour mark.
French playmaker Ntamack struck the post with a penalty just before the break but the pendulum swung towards Wales after Vahaamahina's rush of blood.
Caught on camera recklessly swinging his elbow flush into Wainwright's face, it was only ever going to result in a red card.
His dismissal came as an ironic twist as then Welsh captain Sam Warburton received an early red card for a dangerous tip tackle on Vincent Clerc in that 2011 semi-final in Auckland.
Wales, who had won seven of their last eight games against France, were still made to work for it in a nail-biting finish.
But just when France looked like holding out for a famous victory, Moriarty popped up after a monstrous Welsh scrum.
Making up for his earlier indiscretion, the replacement forward bulldozed over six minutes from time before Biggar kicked the conversion that broke French hearts.
"I think we were slow out of the blocks today... but the character we showed to come through," said Wales captain Alun Wyn Jones.
"Obviously there was an advantage in the second half after the card but we kept plugging away and came out on the right side of the scoreboard."
Wales will take on the winner of Sunday night's Japan-South Africa match in Yokohama next Sunday.
Tries: Wainwright , Moriarty
Tries: Vahaamahina, Ollivon, Vakatawa
Cons: Ntamack 2