The home side made the perfect start to the game and took the lead within five minutes.
Sochaux came close to replying through Roy Contout, who created space to shoot after cutting inside, but he put his effort wide of the post.
After being under pressure for most of the game, the visitors levelled the scores on the hour mark.
Emmanuel Mayuka picked up the ball on the right, cut inside two defenders and fired a strike into the top corner.
Ayew immediately came close to restoring the home side's lead, but Pouplin pushed away his low effort.
With eight minutes left to play, Marseille were awarded a penalty. Gignac saw his shot blocked by the legs of Mathieu Peybernes, but the ball bounced up and hit his hand.
The referee pointed to the spot and Gignac made no mistake, placing the ball down the middle, with the home side holding out to claim the three points.