That result and Monaco's 3-0 win at Troyes — a defeat that relegated its host — means beaten UEFA Europa League finalist Marseille will tackle that competition again next season.
Rudi Garcia's side was on course to pip Lyon to third spot as Morgan Sanson and Kostas Mitroglou scored inside the first 20 minutes to set up a 2-1 win at Amiens, while Lyon was behind to an Alassane Plea goal at half-time.
But Depay turned the game on its head after the break, netting a 48th-minute equaliser from close range before drilling a free-kick through the wall.
The Netherlands international completed his treble and 19-goal haul this season with a sumptuous chipped finish and, although Plea added his second, Lyon held on and denied Nice a spot in the UEFA Europa League. Rennes and Bordeaux — a 4-0 winner at Metz — will join Marseille.
Monaco only needed a point to be absolutely sure of a UEFA Champions League spot, but a brace from Rony Lopes and Jordi Mboula's stoppage-time goal ensured they finished the season in style and condemned Troyes to Ligue 2.
Toulouse will contest the relegation play-off against Ajaccio or Le Havre despite goals from Max Gradel and Yaya Sanogo seeing off Guingamp 2-1.
Caen held champion Paris Saint-Germain to a 0-0 draw to ensure survival and Patrice Garande's side even edged up to a 16th-place finish because of Lille taking a 5-0 hammering at Saint-Etienne.