Football works in mysterious ways. For Inverness Caledonian Thistle, the biblical rain and wind howling through the Caledonian Stadium swept in the cruellest of endings in their search for a miracle to stay in the Ladbrokes Premiership. Amid the deluge yesterday afternoon, the scenes of sporadic celebration throughout this 90 minutes did little to wash away the anguish that set in upon its conclusion.

Knowing only a victory, and anything but for Hamilton at home to Dundee, would do to keep Richie Foran’s side in with a chance of escaping certain relegation, the Irishman watched his team take their third victory in their last four games, eventually racing away from former club Motherwell 3-2.

Goals from Greg Tansey, and two from Alex Fisher all within the space of three second-half minutes lifted the spirits of the bumper and soggy crowd here. But even in the deepest throes of jubilation, the cold reality that it all counted for nothing was not far from returning. By the point Fisher’s second and his team’s third hit the back of the net, news had long since drifted up of Hamilton’s unassailable lead in Lanarkshire.

How bittersweet it was for the Highlanders. Drop rivals Hamilton went into this nerve-jangling finale having lost all four of their post-season fixtures, leading many to tip them to be overtaken by a resurgent Inverness at the death. For Accies to suddenly find goals and form on this of all days, was a dagger to the heart of those who will now wonder just what lies ahead for an Inverness side who have been in the top flight since 2010, and who will be the person to steer them back to where they want to be.

"It's positive for next season,” said Foran afterwards. “Over the last three or four games I've played players I trusted - I probably didn't do that often enough over the season. Too many let me down.

"The damage was done before today. It's a huge learning curve. Would I have learned as much finishing in the top six winning lots of games? Probably not. You need brave people around you. Some jump ship around the club and can't handle it - they're weak.”

The queues of traffic and people on foot streaming towards the Caledonian Stadium right up until kick off spoke of a city filled with belief from the momentum shift in the last two weeks towards their team. For possibly one of the few times in this club’s history, there was a sense Inverness was united behind this one team.

Around 5000 locals turned out and their players responded with a mixture of courage and calmness as they started the better of the two teams. Former Motherwell man Louis Laing smashed a shot at goal from 35 yards out that was palmed away by Russell Griffiths on 11 minutes. They should have been ahead twice before the clock struck 20 minutes, Liam Polworth and Ross Draper both squandering excellent chances with space and time to spare at the edge of the box.

At the other end Motherwell went close themselves, firstly through a Lionel Ainsworth trundler by the far post before a stunning solo run from Chris Cadden ended with a shot being scudded just over the bar.

The first half ended in a lull as news from the SuperSeal Stadium drifted through, but spirits were lifted 10 fold on 64 minutes. It was Tansey with the parting gift before leaving for Aberdeen in the summer as he despatched a low shot across Griffiths and into the bottom corner of the net from 18 yards. A wild knee-slide kickstarted the celebrations and ambitious hopes of a great escape.

Two minutes later and it was two. This time Draper tried his luck again only to skew his shot straight to Fisher for the 26-year-old to divert into an empty net from five yards out. Astonishingly, it was three within a minute as Motherwell officially lost the plot, this time Fisher grabbing his eighth of the season by flicking on a Draper header as a bamboozled defence watched on.

For Motherwell, they did rally but, much like their hosts’ season, it was too little too late. On 73 minutes James McFadden scored what could be his last ever goal for Motherwell, heading home a rebound from an Elliott Frear shot off the bar having just been on the pitch for around 10 seconds. Fellow sub Ryan Bowman converted from the penalty spot in the dying seconds after Craig Clay was bundled over in the box by David Raven, sparking strange scenes of celebration from the goalscorer as defeat was still looming. It was a response which clearly irked his manager Stephen Robinson.

“I’m not pleased with a player celebrating when we are 3-2 down as if we have won the league,” said the Northern Irishman. “We can’t have that mentality at this football club.

“We have to have a mentality where it hurts to lose football matches. Perhaps that’s why we are where we are. We have 13 contracted players. I would like to make a lot more changes than that.”

On the topic of his No.2 McFadden, who is out of contract this summer, Robinson added: “We will have to sit down and discuss that with the staff. I wouldn’t imagine James would be involved in the playing side now.”