Paolo Maldini's final Serie A appearance at the San Siro ended on a losing note as AC Milan slipped to a 3-2 defeat against Roma in a thrilling match.
The visitors twice lost the lead as Massimo Ambrosini scored a second-half brace before being sent off after Francesco Totti's 85th-minute winner.
The result seals Roma's place in the Europa League, while Milan are all-but certain of securing a spot in the Champions League group stages due to a vastly superior goal difference to Fiorentina, who go into the final round of matches three points adrift of a place in the top three.
Full-back John Arne Riise and French forward Jeremy Menez scored Roma's first two.
Pre-match talk revolved around Maldini's impending retirement and the continued speculation regarding manager Carlo Ancelotti's potential move to Chelsea and perhaps unsurprisingly it was Roma who started the game more focused.
With five minutes gone the lively Totti spotted a gap and drilled a shot just wide from 35 yards, before teeing up Philippe Mexes four minutes later, only for the centre-half to miss with a speculative attempt.
Totti continued to try his luck, again shooting from range as the home defence sat a little deep.
While his first attempts had been hopeful, the Italy striker made Rossoneri goalkeeper Dida work after half an hour, forcing a smart save from the Brazilian.
With nine minutes to go before the break, Riise went one better, burying a left-footed free-kick into the top corner from 30 yards.
With fans protesting loudly against owner Silvio Berlusconi and Milan continuing to suffer stage fright on Maldini's big day, things were close to getting even worse, with Mirko Vucinic unlucky not to make it 2-0 seconds before half-time.
Clarence Seedorf replaced David Beckham at the interval but the second half started slowly and it was not until the hour mark that the game truly cranked into gear, Andrea Pirlo lashing a right-footed drive just wide of the post.
Nevertheless, it was not until 15 minutes from time that the second goal was scored, Filippo Inzaghi laying the ball to Ambrosini for him to blast home from the centre of the box.
Parity lasted only five minutes with Menez collecting a Riise pass before burying the ball in the bottom corner.
By now, the action had sped up considerably and it was 2-2 within a minute.
Kaka was the provider this time, with Ambrosini again providing the finish.
The scene was set for Totti, perhaps unfortunate not to already on the scoreboard, and he gleefully claimed it, hammering home a free-kick with five minutes left to seal victory.
Ambrosini, meanwhile, blotted his copy book somewhat when he was sent off in the 88th minute.
Elsewhere, champions Inter went down 2-1 Cagliari despite Zlatan Ibrahimovic's early strike. Goals from Andrea Cossu and Robert Acquafresca sealed the win.
Alessandro Del Piero scored twice as Juventus won 3-0 at Siena.
Gianvito Plasmati scored twice as Atalanta and Palermo drew 2-2, while Lecce and Fiorentina drew 1-1.
Walter Zenga resigned after Catania beat Napoli 3-1 at home while Sampdoria and Udinese 2-2.
Diego Milito netted twice as Genoa beat Torino.
Chievo Verona and Bologna drew 0-0.