The result lifts L'OM up to second in the league table with 41 points from 21 matches, just a point behind leaders Lyon.
© PA Photos
Marseille's sloppy start to the second half enabled Montpellier to surge ahead on 56 minutes when Utaka turned in Remy Cabella's cross from close range.
Cabella himself could have added his name to the scoresheet just after the hour mark when he shot on goal from inside the area, but saw it turned away by Steve Mandanda.
Marseille piled on the pressure to grab the equaliser in the remainder of the match and duly scored their second goal of the evening with 11 minutes of normal time left to play.
Ayew put in a good cross inside the Montpellier penalty area and his brother Jordan Ayew touched it home from just yards out.
Then in the first minute of injury time Gignac took advantage of a defensive mistake to slot home the winner for Marseille.