France kept their Six Nations title hopes alive with a thrilling victory over a spirited Scotland at Murrayfield, their eighth in a row in the fixture.
Scotland led 14-9 at half-time, full-back Stuart Hogg touching down after a hopeful high kick and wing Tommy Seymour crossing for the hosts.
France wing Yoann Huget scored an interception try after an ill-advised miss-pass by Duncan Weir, but Weir regained the lead for Scotland with a penalty.
Scott Johnson's side looked to have done enough to secure a deserved victory, only for replacement scrum-half Jean-Marc Doussain to win it with a last-gasp penalty.
It was a bitter outcome for Scotland, who showed great spirit and no little skill, in stark contrast to their chastening defeat by England at Murrayfield last month.
France host Ireland next Saturday with the sides level on six points. The winner of the match between England and Wales on Sunday will also go into the final weekend with six points.
Philippe Saint-Andre made seven changes to the France side humbled by Wales a fortnight ago, but only three of them because of injuries.
With number eight Louis Picamoles having been dropped, France had an entirely new back-row of Sebastien Vahaamahina, Alexandre Lapandry and Damien Chouly, with the last two making their first starts in the Six Nations.
Wing Maxime Medard, centre Maxime Mermoz and scrum-half Maxime Machenaud were also included in the starting XV, and it was the unfamiliar visiting outfit that made the brighter start.
Racing Metro's Machenaud, in for Toulouse number nine Doussain, kicked the first points of the game after Scotland collapsed a scrum.
France have been criticised for their lack of attacking ambition in this year's Six Nations but they almost scored from a sweeping move after 10 minutes.
Scotland hooker Scott Lawson spilled the ball inside the French half, full-back Brice Dulin sent the ball down the line and Toulouse flyer Huget very nearly beat his man on the outside.
Huget managed to feed the ball inside to Maxime Mermoz before Mathieu Bastareaud bulldozed his way to within a few metres of the Scotland line. However, France had to make do with a penalty from Machenaud after an infringement at the breakdown.
But Scotland hit back almost immediately with their first home try for four matches, full-back Hogg sending up a hopeful high kick and touching down the loose ball.
France quickly regained the lead through another Machenaud three-pointer after Mermoz was brought down just short of the try-line.
But Scotland hit back again, scoring their second try of the game after a beautifully crafted move straight from the training ground.
The ball was shipped to Matt Scott and the Edinburgh centre slipped the ball inside to Glasgow wing Seymour, who raced clear to touch down unopposed after a suspected block on Jules Plisson.
Scotland, seemingly buoyed by the last-ditch victory over Italy in Rome a fortnight ago, led 14-9 at half-time after an encouraging first 40 minutes.
Scotland's back-row, the make-up of which had attracted much criticism, was particularly impressive, with recalled captain Kelly Brown providing much-needed leadership and number eight David Denton seemingly everywhere.
Meanwhile, France's line-out was atrocious before the break, with Brice Mach, in for the injured Dimitri Szarzewski, losing six throws.
The hosts started the second half brightly, but when Weir attempted to find Alex Dunbar with an unnecessary miss-pass inside the French 22, Huget was alive to the threat and intercepted before galloping the length of the field to score. Machenaud slotted the conversion to give France the lead.
Greig Laidlaw came up short with a long-range penalty kick that would have given Scotland the lead, but Weir was on target a couple of minutes later.
With France's scrum having gone the same way as their line-out in the second half, their three-quarters were unable to create much, and Scotland looked to have done enough to secure the victory as they snuffed out France's infrequent attacks with the minimum of fuss.
However, after a Weir penalty drifted wide after 75 minutes, Doussain secured the victory for the visitors with a minute remaining, replacement lock Tim Swinson having been penalised at the breakdown.
Scotland: S. Hogg, T Seymour, A Dunbar, M Scott, S Lamont, D Weir, G Laidlaw; R Grant, S Lawson, G Cross, R Gray, J Hamilton, J Beattie, K Brown (captain), D Denton
Replacements:Wilson for Beattie (17), Evans for Lamont (29), Ford for Lawson (51), Swinson for Hamilton (68)
France: B Dulin, Y Huget, M Bastareaud, M Mermoz, M Medard, J Plisson, M Machenaud; T Domingo, B Mach, 3-N Mas, P Pape (captain), Y Maestri, S Vahaamahina, A Lapandry, D Chouly
Replacements: Tales for Plisson (46), Guirado for Mach (47), Flanquart for Maestri (59), Slimani for Mas (59), Claassen for Vahaamahina (66), Fickou for Bastareaud (68), Debaty for Domingo (68), Doussain for Machenaud (74)
Referee: Chris Pollock (New Zealand)
Touch judges: George Clancy (Ireland) & JP Doyle (England)
TV: Gareth Simmonds (Wales)