For seven long minutes of added time, Rugby Park held its breath.

When Kilmarnock goalkeeper Sam Walker punched away a probing cross rather than catching it in the frazzled final seconds of added time it was almost too much for Derek McInnes, who made his frustrations more than clear.

When the whistle went, however, it unleashed a torrent of jubilation as the Ayrshire side gleefully celebrated what could be a hugely significant three points in their quest to survive in the top flight.

“It was heroic at times,” said McInnes. “I thought the effort was brilliant and the connection with the support was there and we are going to need that. It was a very good day’s work for us.

“The performance was very similar to the St Johnstone and Motherwell games where it felt like we had two points ripped away from us We only had two points to show from two strong performances. I thought today we needed to see that game out and we did it with ten men. It reinforces how strong a performance it was to do it with ten men.

“We restricted a very strong Hearts team littered with top players to very little.

“It felt like we were always on the edge and we were playing last-minute football for 40 minutes or so... it was a real shot in the arm for us to see the game out.”

And they were worth it too. Not only did they have to come back into the game after gifting Lawrence Shankland a seventh minute opener, they also played more than 30 minutes with a numerical advantage after Rory McKenzie was dismissed on the hour mark. The midfielder, booked at the start of the second half, caught Jorge Grant just below the knee in an incident that VAR reviewed and upgraded to a straight red.

For all their possession, however, Hearts had little of note in the final third.

The Tynecastle side are in the midst of a wretched run of form. This was their third successive league defeat and their fourth defeat in their last five outings. A cushion of seven points that separated them from fourth spot has now dwindled to a solitary point as Aberdeen look to push them all the way for the third place finish.

On current evidence the Pittodrie side look the safer bet.

“It’s about everyone looking at themselves and saying: ‘Am I doing enough?’ “ lamented the Hearts manager after the game.

“Whether it be a player, a sub, the staff, the manager, coaches, whatever. We’ve all got to do better. This club is about winning football matches. We’ve been through adversity before here. It’s part of Hearts – demotion, relegation, administration. We have these difficult periods and we’re having a difficult period just now.

“The only way to get through it is to stick together and fight together.”

The portents had looked good for Kilmarnock in the early exchanges; Kyle Vassell had clipped the side-netting while Joe Wright had headed wide when it had looked easier to score.

It was interesting to see, then, what the reaction would be when Shankland opened the scoring with Hearts’ first foray forward. The Scotland internationalist capitalised on Jeriel Dorsett’s lapse of concentration when he dispossessed the Kilmarnock defender before turning the knife with a low finish into the bottom corner.

Given the precariousness of Kilmarnock’s situation, their resolve was notable in the aftermath of going behind as they rolled up the sleeves.

Vassell, a handful for Hearts throughout the afternoon, was brought down by Zander Clark as he looked to round the keeper who had spilled Armstrong’s initial shot with referee Euan Anderson pointing to the spot.

The Kilmarnock winger held his nerve during a lengthy VAR check for an offside call in the build-up to the move before netting his tenth goal of the season. Buoyed by the goal, Kilmarnock took a grip of the game and got their reward on the cusp of the interval.

Armstrong turned provider this time as he sent a cross into the box that looked fairly innocuous for Clark but the Hearts goalkeeper was in no-man’s land as he missed the ball. Doidge was able to bundle the ball in at the back post to give Kilmarnock the lead.

They held onto it to move six points clear of Dundee United and four clear of Ross County who host Celtic later today.