A late Bafetimbi Gomis goal clinched fifth place for Marseille and ensured the Ligue 1 side will play in European competition next season.