Keeper Gennaro Bracigliano, who will deputise for the suspended Steve Mandanda when Marseille take on Bayern Munich at the Stade Velodrome in a Champions League quarter-final next week, failed to deal with a high ball, allowing Johan Christophe Ayina to poke the ball into the empty net in the 119th minute.
Marseille, who dropped to ninth in Ligue 1 after five consecutive defeats, twice came from behind thanks to France striker Loic Remy but Bracigliano's blunder cost them a place in the last four.
At Caen's Michel d'Ornano stadium, where the game was played to allow more fans, a minute's silence was observed before kickoff in memory of the seven people killed in three separate shootings in one week in Montauban and Toulouse.
The hosts went ahead on six minutes when Julien Valero volleyed home from a free kick.
Marseille came close shortly before the break but Issa Coulibaly pulled off a lightning-quick save to punch away Rod Fanni's deflected cross.
Marseille replaced midfielder Charles Kabore with Ghana forward Andre Ayew, whose bicycle kick in the 56th minute went just over the bar.
Remy came on for Brandao to inject some pace and it paid off five minutes from time when the France striker found the back of the net from close range after latching on to an Andre Ayew header, sending the tie into extra time.
Ayina scored with a fine volley in the 111th minute, only for Remy to equalise again from close range one minute later but the hosts eventually clinched a deserved victory.
On Wednesday, Ligue 1 leaders Paris St Germain take on Olympique, Montpellier travel to third division GFCO Ajaccio and Valenciennes host Stade Rennes.
- Sports & Recreation