Adam Rooney's dramatic last-minute goal earned Aberdeen a place in the semi-finals of the Betfred Cup at the expense of St Johnstone.
A tight affair at Pittodrie was heading for extra time until the Irishman glanced home a superb header to earn Aberdeen a 1-0 win and keep Derek McInnes' men on track for a second trophy in four years.
The Dons preparations were dealt a blow before kick-off when Jonny Hayes picked up an injury in the warm-up, meaning Niall McGinn, who had been named as a substitute, started in his place.
However, the hosts began on the front foot and carved out an early opening, Jayden Stockley squaring for Graeme Shinnie, whose effort from 16 yards out was well charged down by Liam Gordon and the ball diverted behind for a corner.
Shay Logan fired wide with a shot from distance in the 15th minute for the hosts while Steven MacLean's clipped effort down the other end soon after sailed over the crossbar.
St Johnstone skipper Steven Anderson made a sliding block from Kenny McLean's angled drive in the 33rd minute but while the home side continued to probe, they failed to seriously trouble Zander Clark in the visiting goal.
Just before half-time, McGinn sent a dangerous ball into the box for Wes Burns but he could not direct his effort on target.
Aberdeen's bright spark was James Maddison and at the start of the second period, the on-loan Norwich youngster delivered a dangerous free-kick into the area but there were no takers on the end of it.
Saints did not offer too much as an attacking threat prior to the interval, but went close in the 52nd minute when Danny Swanson saw his powerfully-struck shot from just outside the area fly inches over the crossbar.
McLean should have given Aberdeen the lead in the 61st minute when he blazed over from Maddison's corner
McLean was unmarked at the near post but he could not keep his volley down.
When David Wotherspoon slotted in Swanson's through-ball in the 68th minute, the visitors thought they had broken the deadlock only for the assistant referee to raise his flag for offside.
It was a let off for the Dons, who then introduced Rooney and Peter Pawlett in place of Stockley and Burns.
With an additional 30 minutes looming, Wotherspoon so nearly won the tie for St Johnstone with a 30-yard free-kick which home goalkeeper Joe Lewis superbly touched onto the crossbar before the Dons defence cleared the danger.
But it was Aberdeen who claimed the win when Rooney notched in the dying seconds, nodding in Shinnie's left-wing cross to send the home support into raptures.