Cedric Bakambu delivered another major blow to Lyon's title hopes as his 89th-minute winner left them eight points behind Ligue 1 leaders Paris St Germain.
While Sochaux will celebrate Bakambu's strike for catapulting them out of the drop zone it further derailed Lyon's hopes of reclaiming the league crown following a run that has now seen them without a win in four games.
On a frustrating night for the hosts, that saw them hit the woodwork on three occasions, they looked like they might salvage at least a point when Bafetimbi Gomis' 69th-minute penalty cancelled out Giovanno Sio's opener.
But an unmarked Bakambu left them with no time for a second comeback after Sio's clever build-up play.
Sochaux's win, their first in six games since upsetting PSG, moves them two points clear of danger.
The visitors gave as good as they got in the opening 45 minutes, albeit after suffering an early scare when Alexandre Lacazette fizzed an 18-yard drive narrowly over following Clement Grenier's flick on.
Lyon goalkeeper Remy Vercoutre made the first save of the game on 24 minutes when he denied Sebastien Roudet after Bakambu's quick break.
Vercoutre then tipped a Sio header onto his post before the ball was cleared to safety.
Sochaux goalkeeper Simon Pouplin's most nervous moment of the opening half was to punch away a swerving Grenier free-kick in the shadows of the break.
The visitors stole into an unexpected lead five minutes after half-time when Sio again outjumped the Lyon defence. Ryad Boudebouz's cross invited him to spring above his markers and power in a header.
Lyon hit the frame of the goal for the first time on 67 minutes when Lacazette rattled the crossbar before the midfielder won a penalty moments later above drawing David Sugent into a mis-timed tackle.
Gomis thumped home the spot-kick, despite Pouplin getting a touch on the ball, and it seemed Lyon were the most likely winners as Lisandro Lopez then hit the woodwork moments later.
The ball also appeared to rebound off the post onto Boudebouz's hand but was not spotted by the referee.
Pouplin then turned away a Lacazette free-kick before Sochaux applied the sucker-punch when Sio outfoxed Lovren before delivering a cross for the unmarked Bakambu to turn in.
There was still time for Lyon to hit the post again with Grenier's free-kick kept out with the slight aid of a Pouplin deflection.