France 20 Wales 18
Wales were denied a sixth successive win against France - and third on the bounce in Paris - after Les Bleus scored a winning try in the 20th minute of stoppage time.
Full-back Leigh Halfpenny looked to have kicked Wales to victory, but replacement France hooker Camille Chat touched down for a try following incessant pressure, and fly-half Camille Lopez's winning conversion after 99 minutes and 55 seconds completed a remarkable 20-18 win.
Toulon star Halfpenny's six penalties included three from near the halfway line, but Wales saw their hopes of securing a top four world ranking ahead of May's 2019 World Cup pool draw in Japan dashed during a frantic finale, with Ireland now guaranteed their spot as a top seed.
It condemned Wales to a third defeat of this season's RBS 6 Nations campaign, and means they lost to France for a first time since the 2011 World Cup.
France led by 10 points after 15 minutes courtesy of centre Remi Lamerat's try, plus a Lopez conversion and penalty, but for all their early promise, Les Bleus could not build on such foundations and managed just one more Lopez penalty until the dying seconds..
Wales did not remotely reach the heights of last week's win against Ireland, when they outscored their opponents 3-0 on tries, but a strong recovery after Les Bleus' strong start saw them denied at the death.
Halfpenny landed six out of six shots, and France only had themselves to blame for allowing him regular opportunities that kept the scoreboard ticking over, but they struck after a prolonged closing phase during which Wales had replacement prop Samson Lee in the sin-bin for a period.
France flew out of the blocks, putting Wales under sustained early pressure, and they went ahead through a seventh-minute try after Lopez sent a long-range penalty attempt just short.
Les Bleus were eager to keep ball in hand, and they tested Wales out wide before Lopez smartly kicked into space over the Welsh defence and Lamerat caught cleanly to claim a smartly-worked touchdown.
Lopez added the conversion, and Wales remained on the back foot as France number eight Louis Picamoles continued his barnstorming Six Nations form by making in-roads through some trademark surges that exposed Wales' close-quarter defence.
And with Wales' scrum in trouble - notably tighthead prop Tomas Francis - it was no surprise when Lopez extended France's lead through a 38-metre penalty as their opponents struggled to establish any momentum.
But Wales opened their account with a Halfpenny penalty after fly-half Dan Biggar's pass to unmarked wing George North was knocked on by Virimi Vakatawa, and after consulting with television match official Peter Fitzgibbon, referee Wayne Barnes sin-binned the French player.
The decision was predictably met by raucous booing, yet Halfpenny was not put off his rhythm, and an angled strike at least got Wales off and running following a difficult opening quarter.
And the full-back came up trumps again nine minutes later, this time bisecting the posts from 50 metres to keep Wales in touch, before France lost Lopez for a head injury assessment, with Francois Trinh-Duc temporarily replacing him.
Despite France continuing to dominate possession and territory, they could not back up their initial promise, and Halfpenny completed his penalty hat-trick just before the break to keep Wales firmly in touch at just one point adrift going in to half-time.
The opening 10 minutes of the second-half saw errors abound on both sides before Wales suffered an injury blow when captain Alun Wyn Jones was forced off with appeared to be a problem with his left arm.
Luke Charteris took over from Jones, while Wales' interim head coach Rob Howley followed it with a double substitution, sending on Taulupe Faletau and Jamie Roberts for Ross Moriarty and Scott Williams, respectively, immediately after Halfpenny landed another long-range penalty to put his team ahead for the first time.
Life, though, did not get any easier for Wales, as Jake Ball followed his second-row partner Jones out of the action, meaning that reserve hooker Scott Baldwin went on as the visitors were left with just one recognised lock in Charteris.
Halfpenny and Lopez then exchanged penalties, setting up a tense final 10 minutes, but French indiscipline continued to dominate, and Halfpenny gave Wales a hint of breathing space with another penalty nine minutes from time.
France, though, finished strongly, camping in Wales' 22 during chaotic dying seconds through a series of scrums, and the visitors ultimately could not hold out as Chat struck for a try that Lopez converted.