Lewis Ferguson scored with the last kick of the ball to earn Aberdeen victory in Finland and ensure they progress in the Europa League qualifiers.
The Dons suffered a shocking start to the second leg, with RoPS Rovaniemi netting inside two minutes to put themselves in the driving seat on the away goals rule.
But Sam Cosgrove converted a 27th-minute penalty and Aberdeen endured precious few scares before Ferguson broke clear right at the end of four minutes of stoppage-time to seal a 2-1 victory.
The 4-2 aggregate win sends Derek McInnes and his players into the second qualifying round to take on Georgian side Chikhura Sachkhere.
It was job done for Aberdeen in the capital of Lapland but the tie proved far closer than it should have been.
The Dons had 33 efforts on target in the first leg at Pittodrie before seeing a 2-0 lead cut in half with almost the final kick of the ball.
Their advantage was wiped out completely at the start of the second leg when Tarik Kada held off Scott McKenna before firing a shot that deflected in off Ash Taylor.
Aberdeen set about peppering the home defence with a series of crosses, with Niall McGinn and Ryan Hedges delivering several threatening balls.
Ferguson came close in the 17th minute when he headed inches beyond the post following Shay Logan's centre.
And the former Hamilton player soon won the spot-kick after tempting ex-Kilmarnock defender Mahamadou Sissoko into making a reckless penalty-box challenge.
Cosgrove dispatched the penalty past former Inverness goalkeeper Antonio Reguero.
The striker missed two great chances either side of half-time, firstly sending a free header wide from eight yards following a Hedges cross, and then missing the target from four yards after getting above his marker to meet John Gallagher's delivery.
Hedges and Taylor threatened from long range and McGinn caused panic for the hosts three times in quick succession, delivering dangerous crosses either side of a clever chip which the back-tracking Reguero tipped over.
The tie remained delicately poised though and Aberdeen gradually retreated as the Finns threw men forward in search of a goal that would take it to extra-time.
Joe Lewis saved well from Youness Rahimi and Ferguson raced clear in the dying seconds and saw his deflected effort land over the line after having his initial effort saved.
No Data Analysis info