Two goals in four minutes, including a thunderbolt from Franck Kessie, helped AC Milan come from behind to beat Parma 3-1 on Thursday (AEST).
The Rossoneri's European chase under Stefano Pioli appeared to be losing momentum when Parma went ahead at San Siro through Jasmin Kurtic 44 minutes in.
But Kessie pulled his side level with a spectacular effort after 55 minutes and Alessio Romagnoli's header turned the game on its head in quick fashion.
Hakan Calhanoglu made it 3-1 to secure all three points for Milan in Zlatan Ibrahimovic's 100th game for the club.
Milan saw a Romagnoli header bounce back off the left-hand post in a dominant opening spell.
Giacomo Bonaventura had a tap-in ruled out for offside and Kessie missed a great chance from Rafael Leao's cross, with Parma not really threatening until Gervinho ran through the heart of the Milan defence but fired over.
It was Gervinho who helped to fashion the breakthrough, though, his clever pass sending Alberto Grassi clear to cut back for Kurtic, who fired low past Gianluigi Donnarumma.
Parma were largely restricting Milan to speculative shots from distance, a tactic that was working well until Kessie thumped an unstoppable strike in off the right-hand post 10 minutes into the second half.
It was 2-1 before the hour mark, Romagnoli escaping into space to nod in Calhanoglu's expert delivery, and Dejan Kulusevski's shot that deflected onto the crossbar suggested fortune was not favouring the visitors.
Calhanoglu made certain of a seventh Milan home league win over Parma in the past eight meetings, the midfielder drilling home a fine finish from Bonaventura's pass.
What does it mean? Never mind top four - Milan are finishing as one of Serie A's form sides
Milan could still qualify for the Champions League after this win, although it would require Lazio to lose all of their remaining games and a few favourable results involving Napoli and Roma.
A sixth season without playing among Europe's elite might be almost certain, but the Rossoneri can at least be pleased with their form since Italian football returned - especially since Pioli appears destined to be replaced by Ralf Rangnick for next term.
Calhanoglu holds the key
Calhanoglu had more touches (80) and passes (58) than any Milan player except Kessie, set up their first two goals and scored the third himself. You will struggle to find a more influential display in that regard.
Theo loses track
Theo Hernandez wasted a couple of good openings at 0-0 and Parma's opener came when they found far too much space down the left of the Milan defence.
Milan host Bologna on Saturday, with Parma at home to Sampdoria a day later.