Dijon came from behind on the last day of Ligue 1 on Friday to beat Toulouse, 2-1, and grab a lifeline that could keep them in the French top flight.
"It was the day of an exploit," said Dijon manager Antoine Kombouare.
At the start of the final round, Guingamp were sure to finish last, while Dijon occupied the other direct relegation spot, one point behind Caen occupying the pace that brings a playoff against a Ligue 2 team. Both could have caught Monaco and Amiens and escaped altogether.
Dijon needed to win but fell behind at home to a 33rd minute goal by Bafode Diakite. Naim Sliti levelled after 58 minutes. Four minutes later, Julio Tavares smashed in a close range shot that Mauro Goicoechea reached but could not stop only for the assistant referee to flag off side. Referee Mikael Lesage consulted video replay and awarded the goal.
Caen, who had needed only a draw to stay clear of Dijon, lost 1-0 at home to Bordeaux despite frantic second-half pressure. Younousse Sankhare headed the only goal of the game after 19 minutes and were relegated.
Asked if he was disappointed, Caen president Gilles Sergent told French television: "The word is too weak. We had our destiny in hand tonight, all we had to do was win or just draw."
"We feel ashamed tonight," he said. "We're going to have to prepare for the next season in Ligue 2. That's hard to say."
Caen's defeat meant Monaco, who suffered an ugly 2-0 loss along the Riviera at Nice and Amiens, who beat Guingamp 2-1, were safe.
"This season was very hard for everyone," said Leonardo Jardim who started and finished the season as Monaco coach but was replaced from October to January by Thierry Henry. "I am very relieved and very happy."
Paris Saint-Germain, long ago confirmed as champion, lost 3-1 at Reims but still finished 16 points clear. Kylian Mbappe scored the PSG goal to finish the season on 33 goals, 11 more than the next highest scorer in Ligue 1, Nicolas Pepe of Lille.
- 'Proud and happy' -
Lille, already sure of second and a place in the Champions League group stage, subsided 3-1 at Rennes, finishing the match with 10 men.
Lyon, sure of third and, at the least, a place in Champions League qualifying, scored in the 89th minute and then in added time to win 3-2 at Nimes.
"I am proud and happy," said Bruno Genesio, after his last match as Lyon coach. "I asked the players to finish the season well. They did it."
Mario Balotelli earned the other red card of the final day, stamping on an opponent with three minutes left but Marseille still beat Montpellier 1-0, to take fifth place.
Dijon will now play Lens, who finished fifth in Ligue 2 but beat Troyes in a the playoffs earlier Friday, for a place in Ligue 1. The two-leg playoff begins on Thursday.