Marseille - a lowly eighth in French Ligue 1 - lost the last-16 second leg on the night, but scoring in Italy courtesy of substitute Brandao's 91st-minute goal secured a 2-2 aggregate result - enough to end Inter's hopes of emulating their Champions League success of 2010.
They carried a 1-0 lead to Milan from the first leg in France, but were pegged back in the tie when Diego Milito popped up on 75 minutes to scramble the ball home after Giampolo Pazzini saw an effort blocked seconds earlier.
The defending was quite awful from Esteban Cambiasso's mediocre corner, but the comedic defending was not over for the evening as Marseille struck amid some farcical scenes.
With a minute played of three added on by the referee, Brandao - on for Mathieu Valbuena in the 88th minute - won it for Didier Deschamps's side when he slotted a shot beyond the stricken home goalkeeper Julio Cesar after Lucio somehow missed visiting goalkeeper Steve Mandanda's long clearance.
Brandao slammed the shot through the legs of Walter Samuel's despairing lunge from the edge of the box, and beyond Cesar to the disbelief of the 70,000 home fans. There was still time for Mandanda - who had been booked earlier for time-wasting - to be sent off when he clawed at the feet of the Inter substitute Pazzini with a minute left.
Pazzini picked himself up off the deck to stick the penalty beyond replacement goalkeeper Gennaro Bracigliano, but it was the final action of the night as the final whistle sounded with Inter 2-1 winners on the night, but out on aggregate courtesy of Brandao's first goal in the competition for 18 months.
It was a bitter pill to swallow for Inter coach Claudio Ranieri, whose side seemed destined to force the match to extra-time.
In truth, he was poorly served by Wesley Sneijder and Diego Forlan, who were both whipped off midway through the second period having contributed little of real note to their side's workmanlike performance.
Forlan continues to look like he is in the wrong movie having disappeared down the tunnel immediately after being wheeled off by Ranieri.
Inter compiled their best moments early in the first period when Javier Zanetti embarked on a rangy run before supplying Sneijder, whose shot was blocked by Mandanda on eight minutes.
Mandanda then foiled Milito, who chested the ball towards goal from Sneijder's cross only for the Marseille keeper to repel the effort with some ease. In hindsight, a header may well have brought Milito greater riches.
Marseille were looking comfortable despite doing little or nothing going forward. Cesar kept out Alou Diarra's header on 69 minutes, but it was to prove in vain in the dramatic conclusion to the evening.
Marseille last went this far in the Champions League when they won the tournament in 1993.