Milan: Senegal striker Khouma Babacar's last-gap header secured a precious 2-1 win over Palermo on Sunday as Fiorentina moved up to eighth place in Serie A and into contention for a place in Europe.
Palermo's newly-appointed coach Eugenio Corini travelled to Florence looking to end the Sicialians' new club record of seven consecutive defeats, which led to the sacking of Roberto De Zerbi in midweek.
The visitors looked to have done enough in their quest after Mato Jajalo fired a superb 49th minute free-kick inside Ciprian Tatarusanu's near post to level a 25th minute penalty from Viola midfielder Federico Bernardeschi.
Fiorentina had spurned a host of great first-half chances, and several more in the second period.
And the hosts were rescued at the death when Babacar fought to keep several players at bay on his way to meeting a cross from a corner to send a header past Josip Posavec and into the far bottom corner.
Fiorentina are two points ahead of Inter Milan and 13 adrift of leaders Juventus, although Paulo Sousa's men have a game in hand after a fixture at Genoa was rained off earlier this season.
Palermo's eighth defeat on the trot dropped the Sicilians back to bottom spot after they had momentarily left the basement when Crotone suffered a 2-1 defeat to AC Milan.