Peterhead snatched a 1-0 win in their Second Division play-off semi-final at Queen's Park thanks to Andrew Rodgers' injury-time penalty.
It looked as if they would be denied despite dominating, until Rodgers struck with the last kick of the game from the spot.
The visitors, who finished second 24 points behind champions Rangers, started the strongest and only a double save from Neil Parry kept Queen's Park on level terms.
He denied Rory McAllister on both occasions, first from inside the six-yard box and then from 12 yards.
Both sides found it difficult to create clear-cut chances but it was the Blue Toon who again came closest midway through the second half when Rodgers' lobbed effort skimmed the top of the bar.
Parry made another save, this time denying David Cox, but he could not keep out Rodgers' penalty at the death after he had been fouled by Blair Spittal.