Iain Russell's late goal sent First Division Livingston into the last four of the Ramsdens Cup at the expense of Third Division Berwick.
Steven Scougall fired into the bottom corner in 12 minutes to give Livi the lead but Kevin McDonald scored from the edge of the area to level the tie.
Stuart Noble went close for the hosts before Russell headed wide for Livi.
And just as the tie was heading for extra-time Russell drilled the ball home from 12 yards for the winner.
: Barclay, Notman, Townsley, McLeod, Thompson, McLaren, McDonald, Currie, Greenhill (Ponton 73), Noble, Gray (Gribben 78).Subs Not Used: Gall, McLean, Elliot Smith.
: McDonald 52.
: McNeil, Brown, MacDonald, Watson, Talbot, Keaghan Jacobs, Sinclair, Scougall (Fox 88), Bobby Barr, Boulding (Deuchar 55), Russell.Subs Not Used: Jamieson, Kyle Jacobs, McNulty.
: MacDonald, Scougall.
: Scougall 12, Russell 85.
: John Beaton