It was the first victory in the tournament for Sochaux since 1937. Marseille are still without a trophy since the 1993 European Cup.
France forward Djibril Cisse put Marseille in front by nodding in a Samir Nasri cross on five minutes but Sochaux levelled on 67 with a header from striker Moumouni Dagano. Cisse was on target with another header eight minutes into extra-time, this time from a cross by substitute Toifilou Maoulida.
Sochaux equalised again with a header by substitute Anthony Le Tallec on 115. The trophy went to Sochaux after goalkeeper Teddy Richert saved from Maoulida and defender Ronald Zubar in the shootout.
"It's always a challenge when you play a team who are superior at least on paper but we lived up to it superbly," Sochaux coach Alain Perrin said. "I'm extremely proud of my players who gave it all they had and never gave up.
"A shootout is always a lottery but before that we recovered from a goal twice and you have to give us credit for that," added Perrin, who coached Marseille from 2002-04.
Sochaux, the surprise packages in France this season, are fifth in the league with two matches left and have won a ticket to next season's UEFA Cup after Saturday's victory.
Record 10-times winners Marseille, who last lifted the French Cup in 1989, also lost to arch-rivals Paris St Germain in last year's final. Marseille are lying second in Ligue 1.
"It's a big disappointment but I can't reproach my players who gave it their best," said coach Albert Emon.
"We played a league game on Wednesday and another one before that on Sunday so obviously we were tired but we're not looking for excuses. We were not aggresive enough, not fresh enough and that's what made the difference."