Second-tier Livingston sealed their place in the Scottish Cup last 16 after Andrew Shinnie's 119th-minute strike edged them past top-flight Ross County.
Robbie Muirhead put the visitors ahead from the penalty spot after Akil Wright's daft handball gave Livingston the chance to go in at half-time ahead, with the striker tucking away.
County's hit back, Jordan White bundling home in the second-half, but parity lasted only six minutes.
Livingston's Cristian Montano collected a long throw in the box, swivelled and fired the ball into the bottom corner.
It looked more likely that the Championship side would get a third, as Danny Finlayson hit a post with a header before Danny Wilson's follow-up was straight at County goalkeeper Jordan Amissah.
However, the hosts set up extra-time when Ronan Hale stretched to get onto the end of a cross from the right and turned the ball past the keeper.
Both sides had a few more chances, with Kacper Lopata's volley turned around a post brilliantly by Livingston's Jerome Prior, and it looked like we were headed to penalties.
However, Meshack Ubochioma's cross was nodded back down to Shinnie, unmarked in the box and only six yards out, and he turned home to send the travelling fans into raptures.