Igor Budan gave the hosts the lead when he side-footed home from Luca Ceccarelli’s cross on 56 minutes, but in the second minute of stoppage time Pazzini flicked in Samuel Eto’o’s left-wing cross connected with a superb flick to draw the Nerazzurri level.
And with 20 seconds remaining in the game, Maicon delivered a superb cross into the box for Pazzini to head powerfully beyond Francesco Antonioli and take an unlikely three points.
The win moved Inter to within five points of leaders AC Milan, who play Bologna at home on Sunday.
The Azzurri, led by Ezequiel Lavezzi in attack, were always in charge of the match but missed a number of chances as the home fans became restless. And just when it looked like the home side’s title aspirations were fading to nothing, Hamsik struck seven minutes from time from Edinson’s Cavani’s flicked header.