Marcus Fraser's own goal and Amar Fatah's emphatic penalty gave Dundee United a vital three points from a hard-fought Scottish Premiership encounter with St Mirren.
The hosts' first win in four games keeps their faint hopes of a top-six place alive and is a huge boost to Jim Goodwin's side before their Scottish Cup quarter-final against Falkirk.
Goodwin admitted he had one eye on the chance to reach Hampden even as his side prepared for the visit of Stephen Robinson's team, and he was delighted to be heading to be turning his full attention to the knockout competition in a winning mood.
"We didn't want to go into the Falkirk cup game off the back of two defeats," the United manager said. "Tonight's game is done, the whole focus now is the game on Friday."
United had the perfect start, taking the lead after just eight minutes, but they had St Mirren's Fraser to thank.
Vicko Sevelj's powerful shot was well saved by goalkeeper Shamal George, but instead of heading the ball out for a corner, the visiting centre-half inexplicably nodded into his own net.
St Mirren have had a poor record after falling behind this season but grew into the game and had two good chances to level in the first half.
Dan Nlundulu forced a save from a narrow angle and then Mark O'Hara put a shot left of the goal when he had a chance to really test goalkeeper Ashley Maynard-Brewer.
United had the last chance of a competitive first half when Panutche Camara forced George into a save but had to settle for a single-goal advantage at the break.
St Mirren manager Stephen Robinson made a switch at half-time, bringing Jake Young on for Roland Idowu - and he got an immediate reward.
A free-kick on the left allowed Scott Tanser to deliver into the box and, when the ball dropped to the striker, he sliced a shot into the top corner to level the score.
United responded well, but St Mirren went close to taking the lead when midfielder Killian Phillips crashed a header off the woodwork just after the hour mark.
The hosts took the lead from the penalty after a bizarre incident.
As Alex Gogic raised his arm to claim for offside as free-kick was curled into the St Mirren box, it connected with the ball following Ross Graham's flick-on.
After a lengthy video assistant referee check, Fatah stepped up and rifled his penalty past George.
The goal was soon followed by another huge roar from the United support as former Scotland forward Johnny Russell came on for his second debut after rejoining the club earlier in the day.
The Tannadice favourite could not help his side find a third goal to take the nerves out of the finale, but United held firm through six added minutes for a morale-boosting victory.