The Aberdeen club doctor might well have been on stand-by near the Pittodrie dugouts as this thriller would have tested the strongest of football managers' hearts.

In 90-plus absorbing minutes, there was enough drama, mistakes, biting tackles and five superb goals with Jonny Hayes, the Dons winger, firing home the winner against his former club.

The Irishman was in the right place at the right time on the hour mark as Dean Brill, the Inverness Caledonian Thistle goalkeeper, beat away a thunderous David Goodwillie strike after Ross Draper failed the control the ball, and he banged home the fifth and final goal of this pulsating affair.

Hayes was one of several stars in red shirts who battled back from losing the first goal to show the kind of mettle demanded by Derek McInnes, their manager, one of many onlookers stunned by Josh Meekings' headed opener in the 17th minute, courtesy of Greg Tansey's clever free kick into the area as the Dons defence slept. It was a strike that sparked the home side into strenuous efforts to retaliate and Hayes was adamant that their determination to do that was never in question, despite things not working out as they wanted.

"We had a game plan," he said. "The manager had worked out during the week how best to win the game and we worked on our shape which was obviously effective as we went on to win. We weren't at our best, but I felt we did enough to merit the win, even though we had to sit back for long spells.

"Inverness have come on a lot and John Hughes has them playing terrific football, but our manager had us well prepared to counter that. It's nice to get a bit of momentum going, but there's a long way to go in the campaign."

Peter Pawlett's pace was deployed for the Dons as he sprinted 40-yards into the area before over-running the ball at the finish, for which Brill, who had appeared nervy and often unwilling to come off his line, was extremely grateful. He was even happier to see Meekings' opener, his first goal for Inverness Caledonian Thistle and one he might have expected to upset the opposition, though the home side were extremely energetic in their search for parity.

That leveller came when Gary Warren's header back to Brill in the 25th minute fell short, and Adam Rooney reacted to collect the ball, round the goalkeeper and score, his fifth goal in a week and his 11th of the season.

Suddenly, Inverness looked frazzled and when the Dons broke down the left with four minutes of the first half remaining Goodwillie accepted Pawlett's pass in the area and touched a square ball for full-back Shaleum Logan to blast it into the net. There was a clear difference in the zest-factor between these sides and the visitors were relieved as Brill touched Rooney's thumping, strike over the bar at the close of the first half.

Expectations that the Dons would pick up from where they left off, however, crashed five minutes after the restart when Billy Mckay's effort cannoned off Logan and fell for Marley Watkins, whose composed finish was well out of Aberdeen keeper Jamie Langfield's reach.

Yet Aberdeen had more to give as they showed with Hayes' opportunistic winner, which earned three points ahead of Tuesday night's re-arranged Premiership tussle against St Mirren at Pittodrie. Few who watched this game would dispute it's entertainment value, certainly not John Hughes.

"Even at 3-2 down and with 15 minutes to go," the Caley Thistle manager said, "we felt there was another goal in the game and we tried very hard to get it.

"I take full responsibility for our defeat. There were one or two errors on the pitch and that was my fault. These things are going to happen to us throughout the season. We're going to learn from it, We were not going to protect what we had a 2-2. We can go to somewhere like Pittodrie and play our style of football."