The 38-year-old struck midway through the second half to give the Blucerchiati victory, after a tense encounter looked to be heading towards a draw.
Fiorentina striker Dusan Vlahovic had earlier cancelled out Keita Balde’s header on the half-hour mark, whilst Viola defender Lucas Martinez Quarta hit the post as Cesare Prandelli’s side struggled to make an impact up front.
A tight start to the match saw neither team able to find fluidity in play, with a tame Mikel Damsgaard shot at the Fiorentina goal the only meaningful effort in the opening 20 minutes.
At the other end, the Viola looked to launch quick counter-attacks and find Christian Kouame in space, but were let down by wayward passing on the edge of the penalty area.
The hosts eventually broke the deadlock on the half hour mark with one of their first efforts, as Balde’s well-timed run allowed him to nod in at the near post from Gaston Ramirez’s corner.
With Fiorentina looking for an equaliser, Vlahovic raced in behind and saw a low shot closed out, before Giacomo Bonventura’s powerful strike was blocked in the box.
Yet just moments later the visitors were level, with help from goalline technology. A wicked Erick Pulgar freekick was palmed away by Emil Audero, and whilst the goalkeeper showed quick reactions to push away Vlahovic’s follow up, his header had crossed the line.
Sampdoria came close to restoring their lead shortly before half-time as a well worked move created space for Tommaso Augello to whip in a cross from the left, but Morten Thorsby could only head over from close range.
The hosts started the second half on the front foot and earned an early corner, though Maya Yoshida could only drag his header wide.
However, it was Fiorentina that came closest to going ahead as Martinez Quarta met an in-swinging freekick in the box but fired against the post. Seconds later Bonaventura’s vicious effort from range whistled inches wide, as the Viola threatened.
The match suddenly burst into life and Sampdoria raced up the other end, with goalscorer Balde breaking clear and looking to double his tally, The former Inter man got the better of Martinez Quarta to burst into the box but fired into the side-netting.
The hosts were almost gifted a goal with an hour gone as Bonaventura dallied on the ball on the edge of his own penalty area and was robbed of possession by Ramirez to slip Damsgaard in. The Dane’s low cross was sliced clear with Balde ready to tap in though, sparing Bonaventura’s blushes.
With just 20 minutes remaining Sampdoria went ahead once more through substitute Quagliarella. The veteran stepped off the bench to tuck home a cut back from Antonio Candreva on the edge of the box, firing through a crowd to beat goalkeeper Bartlomiej Dragowski.
Martinez Quarta came close with a long range effort, whilst Sampdoria defender Omar Colley headed Cristiano Biraghi’s effort off the line as the hosts protected their lead in the dying minutes.
Sampdoria’s victory sees them move into the top half of the table, whilst Fiorentina languish in 16th place, having only recorded two wins in eight league matches since the turn of the year.