Duvan Zapata beat the offside line in the 26th minute and easily slotted home.
Khouma Babacar pulled Fiorentina level with a brilliant backheel conversion of a Cristian Tello cross.
But Danilo put the hosts ahead again just before halftime by heading home after the defense fell asleep again.
Babacar won a penalty in the 52nd minute, and Federico Bernardeschi duly converted to reset the scoreline.
Mazzoleni brings down the curtain on a draw that, on the balance of play, was probably the correct result.