Gerard Deulofeu spared Gianluigi Donnarumma's blushes as his late strike salvaged a 1-1 Serie A draw at Atalanta in what could prove a crucial point for AC Milan's Europa League hopes.
Milan are locked in a three-way battle for sixth with city rivals Inter and Fiorentina and headed into the contest against high-flying Atalanta having failed to win their past four matches - including a 4-1 drubbing at home to Roma last time out.
And their misery worsened in the first half when a costly error from goalkeeper Donnarumma allowed Andrea Conti to put the hosts ahead on the stroke of half-time.
It looked as though that would be enough for Gian Piero Gasperini's men to take home the points, but Deulofeu intervened with three minutes left on the clock.
The Everton loanee may have been in an offside position when his effort took a huge deflection off Andrea Masiello and nestled in the goal to rescue a point for Vincenzo Montella's men.
Fifth-place Atalanta are now unbeaten in eight matches and are six points clear of Milan, while the Rossoneri occupy sixth - just one point ahead of Fiorentina and four in front of Inter, who own a game in hand.
8 - Andrea Conti is now the defender with the most goals scored (8) this season among the top-5 European leagues. Assurance. #AtalantaMilan-- OptaPaolo (@OptaPaolo) May 13, 2017
Though Milan were boosted by Riccardo Montolivo's return from a long-term knee injury, it was the hosts who started brighter - Alejandro Gomez's drawing cross-shot forcing Donnarumma into action.
Deulofeu was the first Milan player to forge an attempt on goal as the visitors struggled to find space, but the Spaniard's strike was well-blocked by Rafael Toloi.
The winger was the architect of Milan's next opportunity with a neat pass into Gianluca Lapadula's path, but the striker failed to apply the finish from close range.
Gomez should have made Milan pay shortly after, only for the Argentine to be denied by an excellent Donnarumma save, but Milan's goalkeeper turned from hero to villain moments later.
Donnarumma failed to hold onto Leonardo Spinazzola's low effort and Conti was on hand to bundle the ball over the line.
Milan should have restored parity straight from the restart, but Mario Pasalic somehow fired wide of an open goal from Juraj Kucka's cross.
Pasalic could have atoned for that miss shortly afterwards, only to head wide after connecting with Suso's free-kick.
For all Milan's pressure, they would have been further behind if not for a fantastic stop from Donnarumma, who made up for his earlier mistake by brilliantly tipping Frank Kessie's blistering attempt wide.
And that save proved vital in the closing stages as Lapadula's pass pin-balled to Deulofeu - whose stray run offside was not spotted by the officials - and the former Barcelona man's strike deflected into the bottom-left corner to secure a share of the spoils.