Stuart Anderson netted the extra-time winner to send Ross County through to the Challenge Cup semi-finals after an action-packed 3-2 victory over Gretna.
County scored twice in a five-minute spell through Alex Williams and Amick Ciani to establish a first-half lead.
Gretna fought back with goals by Colin McMenamin and Allan Jenkins, but then former County defender Martin Canning was sent off for handling on the line.
Alan Main saved Don Cowie's spot-kick, but Anderson beat him in extra-time.
Ross County: Samson, Gary Irvine, McCulloch, Niven, Dowie, Anderson, Caimi (Scott 104), Adams, Williams (Gunn 71), Cowie, McKinlay (Robertson 80).
Subs Not Used: Malone, Tiernan.
Goals: Williams 35, Caimi 40, Anderson 96.
Gretna: Main, MacFarlane (Jenkins 70), McQuilken, O'Neil (Birch 97), Townsley, Canning, McGill, McGuffie, McMenamin, Grady (Deuchar 55), Skelton.
Subs Not Used: Granger, Fleming.
Sent off: Canning 86.
Goals: McMenamin 73, Jenkins 77.
Ref: A Freeland.