Brice Dulin dived over as France completed a remarkable turnaround to give Les Bleus the win and a bonus point, leaves Welsh players dejected after a fantastic context.
That result leaves France needing to beat Scotland on Friday with a bonus point and make up a 20-point deficit to top the standings.
Wales had the game firmly in hand but picked up two yellow cards in the finale and were left them exposed to France’s late fury.
They lead the table with 20 points with France in third place on 15.
France had lock Paul Willemse sent off 11 minutes from time for making contact with the eye area of Wales prop Wyn Jones, while the visitors played the last eight minutes with 13 men following yellow cards for Taulupe Faletau and Liam Williams, and ultimately could not hold out.
Les Bleus full-back Brice Dulin scored a try two minutes into injury time, giving them a five-point maximum.
Wales had recorded just three Test match victories last year – against Italy twice and Georgia – but they seemed on course to be crowned kings of European rugby once more.
Fly-half Dan Biggar scored 20 points from a try, three penalties and three conversions, while flanker Josh Navidi and wing Josh Adams also touched down to thwart France.
The hosts, though, refused to throw in the towel, and they prevailed through tries by Dulin, lock Romain Taofifenua, scrum-half Antoine Dupont and captain Charles Ollivon, with goalkickers Mathieu Jalibert and Romain Ntamack booting 12 points between them.
Wales found themselves under intense pressure in the first five minutes as Les Bleus’ powerful ball-carriers made headway and Dupont orchestrated matters impressively.
And France opened their account through a sixth-minute try when Taofifenua crashed over from close range and Jalibert converted for a 7-0 lead.
But Wales responded sharply when wing Louis Rees-Zammit sent scrum-half Gareth Davies clear and over the French line, and although he was held up by Ollivon’s tackle, the visitors were soon level.
More sustained work deep inside France’s 22 saw Davies rifle out a pass from the forward base, and Biggar cut a superb attacking line to claim a try that he also converted.
But a breathless opening continued at pace as Dulin kicked over the Welsh defence, Jalibert gathered the bounce and put Dupont into space to score.
Jalibert converted, yet Wales drew level again after 18 minutes as more impressive composure close to the French line resulted in a try for Navidi, and Biggar’s conversion made it 14-14.
Taofifenua departed injured early in the second quarter, before Wales went ahead for the first time through a Biggar penalty.
The game continued at a lightning pace, but France suffered another injury blow when Jalibert was forced off, and replacement Ntamack announced his arrival by booting a 34th-minute penalty to tie things up at 17-17.
Both teams continued to probe space and attack gaps, and France regrouped impressively following Jalibert’s exit due to a head injury, before centre Gael Fickou wasted a gilt-edged try chance when he dropped number eight Gregory Alldritt’s midfield pass.
And that was the final act of a memorable first 40 minutes after Wales stood toe to toe with France and probably shaded the attacking moments.
Wales went back in front through a 46th-minute Biggar penalty, and the visitors continued to dominate the aerial battle before a first change saw scrum-half Tomos Williams replace Gareth Davies.
Williams was immediately playing a key role in the action after flanker Justin Tipuric created an opportunity, then Adams hacked on, before Williams gathered and sent the wing over.
Referee Luke Pearce awarded the try, with no clear evidence that France flanker Dylan Cretin had got his hand underneath the ball and prevented a touchdown, and Biggar’s conversion meant Wales were 10 points ahead.
An Ntamack penalty cut the gap, and then France saw prop Mohamed Haouas sin-binned for collapsing a maul in build-up play to Rees-Zammit just failing to touch down as Wales hunted a fourth try.
France then lost Willemse, but Wales could not close out the game to seal a famous triumph at the end of their Six Nations campaign, with Faletau and Liam Williams being shown yellow cards in rapid succession before Dulin broke Welsh hearts.
Additional reporting by PA.