Andre-Pierre Gignac's last-gasp strike helped Marseille get back to winning ways and keep in touch with Ligue 1 frontrunners Lyon.
Marseille were left reeling when Andre Ayew's 15th-minute strike was immediately cancelled out by Emanuel Herrera before John Utaka gave Montpellier a shock lead just before the hour mark.
OM looked set for a second successive defeat - after a shock 3-1 loss against 10-man Sochaux last Sunday - but Jordan Ayew levelled proceedings in the 80th minute before Gignac completed the comeback in injury time.
Elie Baup's men are just one point behind Lyon, who were held to a goalless draw at home to Evian last night, but they will know consistency at the back is necessary if a serious title challenge is to be mounted.
The hosts started in impressive fashion tonight, however, with Andre Ayew heading in from Joey Barton's right-wing cross.
But the defending champions drew level less than three minutes later when Utaka split the defence with a through-ball to Herrera, who went round Marseille goalkeeper Steve Mandanda before sending the ball into an empty net.
Romain Pitau nearly gave the visitors the lead soon after when he struck the outside of the post after being allowed plenty of space inside the area, while at the other end, Andre Ayew continued to cause problems as his rasping effort from 30 yards only just missed the target.
The sides could not be separated before the interval and after a quiet opening to the second half, Utaka left the home fans stunned in the 57th minute.
Remy Cabella's cross from the right found the Portsmouth man in acres of space and he was allowed to control the ball before firing past Mandanda.
The Marseille goalkeeper ensured the deficit was kept to just one goal as he kept out Cabella's effort from the edge of the area.
OM picked up the pace in the closing stages with Geoffrey Jourdren saving well from Mathieu Valbuena's curling 25-yard effort but the Montpellier goalkeeper could do nothing when the Ayew brothers linked up to draw Marseille level.
Gignac picked out Andre Ayew on the right and he crossed for Jordan to slot home from close range.
Not content with a point, the hosts continued to push forward and they were rewarded in the second minute of added-on time when Gignac collected the ball from Valbuena before cutting inside Daniel Congre and firing past Jourdren with a right-footed effort.