Starting the weekend eight points adrift of leaders Paris Saint-Germain, Marseille knew they could not afford another slip after a disappointing run of form since the winter break.
But despite dominating the match from start to finish, Marseille could not find a breakthrough until deep into injury time when Fanni beat his man to fire a low shot into the goal and relieve the pressure.
The win sends Marseille into second place, at least until Lyon face a tricky trip to Bordeaux on Sunday.
Nice moved up to fourth in the congested scramble for European places with a 1-0 win over Bastia.
Neal Maupay scored the only goal of the game just after the hour mark, condemning Bastia to a defeat that leaves the Corsicans just three points above the bottom three.
Lorient are seventh, three points behind Nice, after beating Evian 2-1.
Jeremie Aliadiere opened the scoring from the penalty spot three minutes before half-time after he was fouled by Ebert Betao.
Kevin Monnet-Paquet doubled the lead in the 77th minute with a powerful close-range finish, and although Betao soon got one back with an outstanding volley, Lorient hung on.
Toulouse scored twice in the final five minutes to deny Troyes a much-needed win in a barnstorming finish to their 2-2 draw.
Troyes had grabbed the lead with two late goals of their own as substitute Mohamed Yattara slotted home from close range in the 78th minute before Benjamin Nivet grabbed a second five minutes later.
But Eden Ben Basat got one back in the 86th minute, striking a post but then getting the ball back from Aymen Abdennour to make sure second time around, while Etienne Didot lobbed Yohann Thuram-Ulien to level in the 88th minute.
Troyes do at least move off the foot of the table, four points from safety, thanks to Nancy's 1-0 defeat at the hands of Montpellier.
Emanuel Herrera got the only goal in the 34th minute, heading home Anthony Mounier's cross to send Montpellier ninth, still only four points from fourth place.
Brest and Ajaccio shared the spoils in a 1-1 draw. Florian Raspentino put Brest ahead after only 11 minutes, firing a strong shot beyond Guillermo Ochoa, but Dennis Oliech levelled in the 71st minute from close range.