The 19-year-old midfielder, on loan from Newcastle United, somehow found the energy in the dying seconds to make a surging run from inside his own half to support Jordan Jones and, when the winger lost control of the ball, Longstaff strode forward to emphatically drive the ball behind Scott Fox from 15 yards.
The win hoisted Lee Clark’s side into eighth place, level on points with yesterday’s opponents, who slip to seventh.
Considering the fact that there were only 11 seconds on the clock when the hosts took the lead, it should not come as a surprise to learn that it was very much a Route One goal.
Gary Dicker’s speculative header over the top ought to have been dealt with by the visitors but Kris Boyd displayed poise and precision to jog past their static defence and leave the advancing Fox helpless with an audacious chip.
However, the dismal defending which has pock-marked Killie’s campaign was all too evident again yesterday.
Indecision by Karleigh Osborne allowed Alex Schalk to go one-on-one with Freddy Westwood and the goalkeeper did well to smother his shot from point-blank range.
Osborne was also culpable when County equalised, turning his back on the play as Schalk burst down the left and cut the ball back for Christopher Routis to sidefoot home from 12 yards.
Three minutes later County were ahead. The unmarked Kenny van der Weg’s header from Ryan Dow’s corner came back off the bar and the home defence was guilty of ball-watching as Schalk drove home the rebound.
Osbourne, whose start to his Rugby Park career has been unfathomably awful (he conceded the last-minute penalty which gave Hamilton a Scottish Cup victory on his debut the previous Saturday), was cautioned for deliberate handball before County’s equaliser.
He was then fortunate not to be shown a second yellow card when his rash challenge saw him clash heads with Dow in the 32nd minute.
“It’s as clear as day,” said Ross County manager Jim McIntyre. “It’s 100 per cent a booking. Every day of the week but the referee has chosen not to send him off. His reason to me was he didn’t think it was aggressive. Well, my god, he nearly took the back of his head off!
“Killie dodged a bullet and they know they did because they immediately subbed him. Fair play to them; I’d have done the exact same thing.”
Clark replaced the defender with 18-year-old midfielder Iain Wilson, with Dicker dropping into the back four.
The introduction of winger Jordan Jones nine minutes after the restart reinvigorated the hosts and Fox made two fine saves to deny Boyd before Dicker restored parity, driving home after Boyd’s mis-hit shot from a Jones corner fell kindly for him.
With the game turned on its head, Killie also had a decent claim for a penalty rejected when Tim Chow appeared to barge Steven Smith off the ball. Referee Barry Cook thought otherwise, however.
The home support were again enraged when Marcus Fraser appeared to pull Rory McKenzie back by the face and Mr Cook once again refused to award them a penalty. It wasn’t to matter.
“We got off to a great start with big Boydie doing what he does best,” said assistant-manager Lee McCulloch. “Then we were all over the place for the next ten-15 minutes but we got our composure back and finished strongly.”