Substitute Nicola Pozzi's stoppage-time penalty handed Sampdoria their first Serie A win of the campaign as they beat Livorno 2-1 on Sunday afternoon.
The hosts looked to have earned a point after substitute Luca Siligardi had cancelled out Citadin Eder's opener with one minute remaining.
However, they then shot themselves in the foot after Andrea Luci brought down substitute Vasco Regini in the area and the referee pointed to the spot.
Pozzi made no mistake and beat Livorno goalkeeper Francesco Bardi to hand his team three vital points.
The result has lifted the Blucerchiati out of the relegation zone and into 16th place.
Livorno, meanwhile, fell to their third successive defeat and have dropped to 14th position.
The visitors enjoyed a strong start and were given a helping hand when the referee pointed to the penalty spot after Lorenzo De Silvestri was brought down inside the area by Alfred Duncan. Eder's right-footed shot to the far post beat Bardi.
Livorno were unlucky not to equalise on 34 minutes when Leandro Greco's 30-yard attempt struck the crossbar with Samp goalkeeper Junior Costa already beaten.
The home side wasted a great chance shortly after when Costa failed to hold on to Innocent Emeghara's bullet strike and the ball fell to Paulinho, who fired wide from five yards.
Eder should have doubled his team's lead on the hour mark but failed to beat Bardi when one-on-one with the Livorno keeper.
Livorno pressed forward more aggressively and were rewarded with just one minute of normal time remaining.
Cristiano Piccini fed Siligardi on the edge of the area and his left-footed strike towards the far post beat Costa.
However, Samp had the last say when Pozzi struck his spot-kick down the centre of goal where Bardi could not reach.