Shay Logan’s late winner saw Aberdeen book their place in the quarter-finals of the Scottish Cup after a 1-0 win at Ross County.
It was no more than they deserved but just when it looked as if County had done enough to force a replay, the Aberdeen full-back curled a ball in off the far post.
County had the first effort on goal in the third minute when a Marcus Fraser cross was headed well over by Martin Woods.
A promising Aberdeen move ended with an Adam Rooney shot being charged down on the edge of the 18-yard box, and at the other end Fraser burst into the Dons’ box but his low drive flew a yard past the upright.
County’s Tim Chow became the first player in referee Bobby Madden’s book for a rash tackle on Johnny Hayes. Niall McGinn then tried his luck from 22 yards but County goalkeeper Scott Fox managed to tip his shot over the bar.
Then Kenny McLean got on the end of a deep cross from Hayes but his glancing header flew wide of the far post.
Aberdeen were in the ascendancy and they came close again in the 34th minute with a Hayes free kick which flew narrowly over.
Some frantic defending from County in the 43rd minute kept the score goalless with efforts from McGinn and Graeme Shinnie being blocked.
Michael Gardyne needed treatment just before he break after he collided with Dons’ keeper Joe Lewis who charged from his goal to clear the ball.
McGinn had a chance to break the deadlock right at the start of the second half when he dispossessed Jay McEveley but his shot was well saved by Fox.
The home side were under pressure and Fox did well to keep out a strong shot from Dons’ skipper Ryan Jack.
Milan Lalkovic replaced Gardyne in the County line-up in the 53rd minute and he was soon in action, firing a shot just wide of Lewis’ right-hand post.
But most of the action was at the other end, and after Fox got a hand to a Hayes shot, Shinnie flashed an effort wide of the far post.
The visitors were getting closer and following a Hayes corner, an Andy Considine header and a Taylor shot were both kept out at close range.
Aberdeen continued to press for the winner but the County defence were resolute with Fox outstanding in the home goal.
But the winner did come with just three minutes to spare. Logan picked the ball up wide on the right and his low drive flew in off the far post with Fox finally beaten.
County threw everything forward in the dying minutes in search of an equaliser but the Dons held on for a place in the next round.