Ayr United came from behind to send Livingston crashing out of the Challenge Cup courtesy of a superb winner from Jerome Vareille.
The Frenchman raced in at the back post to knock home David Lowing's teasing cross with 15 minutes to go.
Livingston dominated the first half and Steven Craig slammed home Joe Hamill's 17th-minute through ball.
But Ayr equalised out of the blue when Chris Strain's free kick glanced in off the head of Livingston's Steve Hislop.
Ayr United: McGeown, Pettigrew (Campbell 89), Forrest, Robertson, Lowing, Strain, Logan, Weaver, Casey, Caddis, Vareille (Wardlaw 78). Subs Not Used: Friels, Dunn, Johnson.
Booked: Caddis, Lowing, Weaver. Goals: Hislop 28 og, Vareille 75.
Livingston: Craig Wight, Thompson, Mackay, McPake, Miller (Tweed 86), Mitchell, Hamill, Walker, Hislop (Weir 76), Fox (Dorrans 61), Craig. Subs Not Used: Makel, Monteith.
Booked: Craig. Goal: Craig 17.
Ref: M McCurry