Cedric Kante was shown a straight red card late on for the away side, before Tiene dramatically settled the match at the Stade de la Mosson.
The visitors nearly found themselves in front just nine minutes into the game when Hilton almost sliced the ball into the back of his own net at his near post after a cross flew in from the right.
Sochaux went close again just moments later when Cedric Bakambu blasted a shot from an acute angle, but he could only watch his effort come back off the crossbar.
The away side finally got their noses in front just a minute before the break when a floated free kick into the far post was nodded down into the path of Contout, who pulled off two Cruyff turns before slamming the ball into the net inside a crowded penalty area.
Their lead lasted just two minutes, however, as Hilton picked up a loose ball from 25 yards out before unleashing a stunning drive into the top corner to pull Montpellier level in added time.
Montpellier nearly went in front with 25 minutes left after Victor Hugo Montano controlled the ball with his chest before squaring it to Tiene, but his effort was wide of the mark.
Sochaux were reduced to 10 men just 16 minutes from time when Kante was shown a straight red for chopping down Remy Cabella from behind.
The game looked to be heading for a draw until Tiene slotted a loose ball in the penalty area into the bottom corner to win it for Montpellier in the fourth minute of added time.