Ten man Livingston rescued their hopes of reaching the Premier Sports Cup knock-out stages as skipper Nicky Devlin fired home an 88th minute winner against Cove Rangers.
The Lions went into the clash knowing only a victory would do following their midweek defeat to Inverness Caledonian Thistle but they got off to the worst possible start as Esmael Goncalves saw red for an off the ball incident midway through the first half.
Things went from bad to worse just before the break when the Championship hosts took the lead in the first ever competitive meeting between the two sides. Russian stopper Ivan Konovalov was helpless to prevent Iain Vigurs firing home from outside the box.
But the visitors were able to reply almost instantly after the break as Andrew Shinnie and Ayo Obileye both were in the right place at the right time to scramble the ball over the line at the back post with the latter getting the important touch.
Cove, about to enjoy their first ever campaign in the second tier, would create most of the remaining chances but were unable to find a breakthrough. Connor Scully and Mitch Megginson both had shots saved by Konovalov while Robbie Leitch fired wide.
Having weathered the storm, Livingston ended the brighter of the sides with Obileye and Devlin both seeing efforts fly over the bar before the skipper popped up two minutes from time. The right-back was teed up by Stephane Omeonga before planting a wonderful left-footed effort across goal and in off the post to seal a dramatic victory.
The Lions will still need Inverness to drop points if they are to top the group but victory over Kelty Hearts next Saturday in Livi's final group game would give them a fighting chance of being one of the top three runners-up and progress to the last-16.
Don't miss the latest news from the West Lothian Courier. Sign up to our free newsletter here