Andy Delort scored both goals for Nice in their win over Lorient. AFP
Delort had put Nice in front with a penalty early in the second half on the Cote d'Azur after Khephren Thuram had been fouled, but Armand Lauriente quickly equalised for relegation-threatened Lorient.
However, with the game heading for a draw, substitute Kasper Dolberg picked out Delort with a sublime cross in the 88th minute and he headed in his 10th Ligue 1 goal for Nice to secure the victory.
Nice had gone four games without a win to slide from second place down to outside the European qualifying spots altogether before this encounter.
Champions League football is the aim for a club with lofty ambitions under their owners Ineos, the group chaired by British billionaire Jim Ratcliffe.
The victory moves them back to within a point of third-placed Rennes, who lost 3-2 at home to Monaco on Friday.
Only the top two in France qualify automatically for the Champions League, with third place going into the qualifying rounds.
The top two in Ligue 1 meet later on Sunday as leaders Paris Saint-Germain play host to bitter rivals Marseille.
PSG are 12 points clear at the top with seven games left and a victory against Marseille would give them a chance to secure an eighth league title in 10 seasons as early as Wednesday.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)