A dramatic change of fortunes for Ronny Rodelin saw him respond to a saved penalty with a 91st-minute equaliser to earn Caen a 1-1 draw against Paris Saint-Germain and secure their place in Ligue 1 next season.
After failing to convert from the spot with his side trailing with 15 minutes remaining, Rodelin made amends with a crucial late strike after Adrien Rabiot's effort looked set to force the visitors into a relegation play-off against Ligue 2 side Troyes.
Rabiot's 13th-minute strike - his third of the league campaign - seemed to lack the power to find the net but caught the Caen defence napping and beat goalkeeper Remy Vercoutre at his far post to give the hosts the lead.
Patrice Garande's side went into the game just one point clear of the relegation zone and, with rivals Lorient picking up a 1-1 draw against Bordeaux, they could not afford to lose.
Following Presnel Kimpembe's foul on Jonathan Delaplace, Rodelin had a 75th-minute penalty saved by Kevin Trapp. However, the striker pounced in injury time to earn a precious point for his side that kept them out of the bottom three.
-- Stade Malherbe Caen (@SMCaen) May 20, 2017
The result means PSG end the season with a record of 27 wins, six draws and five defeats as Unai Emery's men paid the price for their slow start to the 2016-17 campaign, failing to make up the ground they lost to champions Monaco.
Despite the title being out of their reach, PSG pressed from kick-off and Cavani had the chance to open the scoring inside the second minute but failed to connect cleanly with Angel Di Maria's dangerous cross.
Lucas Moura scampered into the box and squared to Cavani two minutes later, but the Uruguayan's effort was blocked and Serge Aurier shot wide from the rebound.
The visitors could ill afford a mistake but suffered a lapse in concentration after 13 minutes when Cavani fed Rabiot and the midfielder struck a tame shot that sailed through the static Caen defence before beating goalkeeper Remy Vercoutre, who stood and watched as the ball hit the net.
Keen to atone, Vercoutre made a strong save from Giovani Lo Celso six minutes later, diving to his left to punch a powerful 25-yard drive around the post.
Despite their desperate plight, Caen struggled to compete and their only goal threat in a tepid first half came when Yann Karamoh broke clear and turned Lo Celso on the edge of the box before dragging off target.
Cavani almost had the ball in the net after 56 minutes but his header was cleared off the line by the foot of Syam Ben Youssef, before Kimpembe had a strong 25-yard strike saved by Vercoutre.
Caen were handed a potential lifeline when Delaplace went down under a challenge from Kimpembe in the area, but Trapp guessed correctly and dived to his right to save Rodelin's spot-kick.
Rodelin had a chance to make amends two minutes later as Caen surged forward in search of a precious equaliser but the striker's acrobatic scissor kick flew over the crossbar, and there was further concern when Julien Feret had a late goal ruled out for a marginal offside decision.
But Rodelin turned from villain to hero for Caen in stoppage time when he timed his run to perfection and guided Delaplace's cross home to keep his team in the top flight next season.