Sampdoria piled the pressure on AC Milan coach Carlo Ancelotti with a surprise victory at a rain-drenched Luigi Ferraris Stadium.
Antonio Cassano put the Blucerchiati ahead in the 33rd minute with Giampaolo Pazzini adding a second in the 52nd.
Pato reduced the arrears in the 80th minute to set up a grandstand finish, during which Emerson had a goal disallowed as the home side just managed to hold on to all three points.
After crashing out of the UEFA Cup on Thursday, the Rossoneri could slip 14 points behind league leaders Inter Milan tonight - when they play Roma - leaving Ancelotti's job hanging in the balance.
Clarence Seedorf passed a late fitness test to be able to help Ancelotti with his difficult team selection after Ronaldinho, Kaka and Massimo Ambrosini were all ruled out.
The Dutchman started in support of the lone striker Pato, but just like a week ago when after a troubled first half he turned match-winner with a goal against Cagliari, he was largely ineffective.
The Dutchman almost earned the ire of the home crowd when he continued to attack after Cassano had left the ball and stopped playing for a player down injured.
It was a good job his shot was saved by Luca Castellazzi or else the stadium may have erupted.
It very nearly did erupt, with joy, in the 20th minute when Cassano's dangerous 20-yard free-kick was pushed away expertly by Christian Abbiati.
David Beckham was closely guarded out on the right wing and was restricted with his deliveries into the penalty area.
Only once did he manage to swing the ball in dangerously for Pato, who should have seen Seedorf behind him rather than try a spectacular backheel shot at goal.
Cassano then put the home side ahead with a goal which certainly was not to the liking of Abbiati.
Angelo Palombo's corner was headed at goal by Andrea Raggi to Cassano, who was lingering at the far post, to provide the finish which Abbiati thought he had prevented from going over the line, or perhaps that Cassano was in an offside position.
Either way, after consultation with his linesman, referee Gianluca Rocchi gave the goal.
Milan's heads dropped and Samp capitalized with a second goal early in the second half.
Cassano was provider this time with a neat reverse ball to send Pazzini through. The former Fiorentina forward pulled the ball back onto his right foot and, from a tight angle, fired his shot unstoppably into the top corner of Abbiati's goal.
Milan finally found that extra gear with Filippo Inzaghi, a half-time replacement for Luca Antonini, causing confusion inside the Samp penalty area.
Stefano Lucchini made an excellent last-ditch tackle to prevent Inzaghi from pulling the trigger while well-placed inside the penalty area.
What could be Beckham's penultimate game in a Milan shirt if he returns, as contracted, to the LA Galaxy next week, ended when he was replaced by Emerson in the 68th minute.
Milan continued to press for a way back into the game and they found it with 10 minutes remaining when their most dangerous player, Pato, headed Giuseppe Favalli's cross into the bottom corner at the far post.
Two minutes later, Milan thought they had equalised when Andrea Pirlo's free-kick curled into the goal, but Emerson got the deftest of touches to the ball from an offside position and the goal was ruled out.
Samp were showing a lot of tiredness after their trip to the Ukraine in midweek and defended desperately for the remaining eight minutes.