This really was a magnificent seven. Kilmarnock’s seventh home win on the spin would have had Steve McQueen, Yul Brynner and the boys roaring on joyously from the sidelines. It was a quite absorbing night at Rugby Park and the 10-men of Kilmarnock, with great spirit and unwavering resolve, managed to winkle out an extraordinary triumph during a 90 minutes packed with incident, action and some ropey refereeing decisions. A goal scoring debut for Steven Caulker, Dundee’s former England international, would have been a decent enough tale in itself but defiant Kilmarnock remained determined to be the story and, despite playing most of the second period with reduced numbers after Gary Dicker’s red card, late goals from Kris Boyd and Iain Wilson during a barnstorming finale saw a 2-1 deficit with 15 minutes left become a 3-2 victory.

“I never thought it was dead and buried,” said Steve Clarke, the Kilmarnock manager. “It’s always difficult with 10-men but this group have great character and they showed it here. I always thought we could get something out of it."

The visitors were seeking redemption following a dreadful 4-1 mauling by bottom of the table Ross County. The eagerly anticipated debut of Caulker, who was making his first competitive start since last September, gave added interest to affairs. Kilmarnock, meanwhile, were without the influential and industrious pairing of Youssouf Mulumbu and Jordan Jones.

It didn’t seem to hinder them in the early stages. After a couple of initial Dundee thrusts, the hosts delivered a telling blow and forged an advantage in the sixth minute. From a corner on the right, Eamonn Brophy found himself in space at the back post and he angled a low drive into the net.

It was an early dunt to the morale as far as Dundee were concerned but their response was robust. The lively Simon Murray made a menacing, surging assault into the danger zone and his lay off was smacked into the clutches of Jamie MacDonald by the on-rushing Mark O’Hara.

It was a crisp, competitive, open encounter and O’Hara made his presence felt when he clattered into Dicker on the halfway line and earned a booking for his troubles.

Kilmarnock may have held the lead but it was Dundee who continued to grow in stature with patient probings. A considered approach on the half hour ended with Paul McGowan swivelling on the edge of the area and unleashing a looping effort which MacDonald gathered safely.

Dundee’s increasing authority had the restless natives in the stands growling and harrumphing with jittery agitation. MacDonald beat away a powerful Jon Aurtenetxe strike as the visitors upped the ante before an equaliser arrived on 32 minutes from the spot. MacDonald brilliantly palmed away a Caulker header but in the ensuing scramble, Dicker was penalised for a handball. Moussa calmly completed the necessaries to restore parity.

It had been a spirited resurgence from Dundee and while Kilmarnock had the final say of the half with a Brophy shot which Elliott Parish clasped down low, the hosts were left with plenty to ponder as they headed for the tea urn.

Things didn’t improve for Kilmarnock after the resumption as Brophy hobbled away from the front line with an injury and was replaced by Lee Erwin on 49 minutes.

If that was an enforced change, the hard-to-please critics in the stands were demanding more reshufflings. “C’mon Clarke, change this s***e,” came the erudite request. Things did change but for the worse as Dundee went ahead on 56 minutes when Caulker rose elegantly to nod in Roarie Deacon’s corner. Two minutes later, Dundee were given another numerical advantage when Dicker was sent off.

Kilmarnock are made of stern stuff these days, of course, and they rallied admirably. After Murray had spurned a chance to put Dundee further ahead, Clarke’s men countered. Rory McKenzie had a shot blocked before a terrific move spawned a cracking equaliser. Erwin’s fine reverse pass was met by Boyd who finished with clinical aplomb.

Galvanised by that, Kilmarnock ploughed on and were rewarded with a winner in 86 minutes. Wilson, who emerged from the bench on the hour, seemed to stumble through the Dundee defence like a monster in a B-movie but he kept going and going and managed to trundle a low finish into the net via the post.

Caulker had a header in the last knockings saved by MacDonald as Kilmarnock held on.

"It's quite appalling to lose a game in that manner," said a seething Neil McCann.

It's not a bad way to win it, though.

Kilmarnock: MacDonald, O’Donnell, Broadfoot, S Boyd (Wilson 61), Findlay, McKenzie, Tshibola, Dicker, Taylor, Brophy (Erwin 49), K Boyd (Simpson 89)

Dundee: Parish, Caulker, Kusunga (El Bakhtaoui 78), O’Dea, Kamara, Moussa, O’Hara (Spence 89), Aurtenetxe, Murray, McGowan, Deacon (Kerr 72)