Relegated Lens looked poised to earn a credible draw with high-flying Montpellier HSC until Anthony Mounier struck in injury time to increase the pain on their 10 men.
Siaka Tiene went close early on for Montpellier with a well-struck free kick that was just tipped around the post by Rudy Riou.
However, the Lens goalkeeper then had to be taken off midway through the first half through injury, and was replaced by Valentin Belon.
Tiene's set piece remained the best chance of the opening period until two opportunities came the way of Montpellier's on-loan striker Lucas Barrios in first-half added time.
The first, a near-post strike from just inside the box, was well blocked by a Lens defender, before another Tiene free kick went loose in the Lens area, allowing Barrios to lash an effort inches wide of goal.
The home side were reduced to 10 men just after the hour mark when Loiik Landre was given his marching orders after collecting a second yellow card in quick succession.
Immediately after Landre's dismissal, Montpellier captain Jamel Saihi sent an effort narrowly wide after his side's corner had not been adequately cleared by Lens.
Mounier then had a succession of penalty appeals waved away by referee Mikael Lesage, the most legitimate appearing to be when the Montpellier striker went down under the challenge of Taylor Moore.
The visitors could have snatched all three points late on, but Anthony Ribelin could only head Joris Steve Marveaux's cross wide of goal.
That appeared to be their final chance, until Mounier collected the ball wide on the Lens left in injury time and cut inside before sending a shot beyond Belon from the edge of the area.
The 1-0 win leaves Montpellier in seventh place with two Ligue 1 games to play, while Lens remain four points adrift of 19th-placed Metz.