Valentine Holmes has kicked a 92nd-minute field goal to put North Queensland one win away from the grand final with a 32-30 golden-point victory over Cronulla.
In Saturday's earlier match, Canberra ended Melbourne Storm's season with a 28-20 win in their elimination final in Melbourne.
In front of 12,447 spectators at Shark Park, Cronulla and North Queensland were tied up 30-30 at the end of regulation time in their qualifying final after a late Jason Taumalolo try for the Cowboys.
After 10 minutes of extra time when neither side was able to score, it was left to Sharks premiership winner Holmes to slot the two-pointer against his former team and give the Cowboys victory from 44 metres out.
The win guarantees the Cowboys will host a preliminary final in Townsville for the first time.
The winner of the semi-final between Parramatta and Canberra is the only hurdle remaining between them and a place in the grand final.
The defeat was just the Sharks' second at home this season and they will now face the winner of Sunday's clash between the Sydney Roosters and South Sydney in a sudden-death game at the Sydney Football Stadium next week.
Cronulla's points tally was the highest for a losing side in a finals match since 2014.
The Sharks would be kicking themselves as with eight minutes to go in regular time they were firmly in control.
They led by eight points until Connor Tracey was sin-binned for taking out Holmes as he attempted to dive on an in-goal grubber.
Holmes added the penalty goal before converting a late barge-over from Taumalolo sent the game into extra time.
Cronulla halfback Nicho Hynes had a field goal charged down in extra time, before Holmes notched his in golden point.
It was nip and tuck throughout the match with the scores tied 18-18 at half-time, and then 30-30 at the end of 80 minutes.
Chad Townsend was key to the Cowboys' fortunes as he returned to play his former club for the first time since leaving for Townsville last year.
His kick set up Tom Gilbert for the opening try of the night with Peta Hiku and Tom Dearden also scoring to help the Cowboys get away to a fast start.
Hynes was faultless from the tee converting tries from Toby Rudolf, Siosifa Talakai and Will Kennedy.
Cowboys winger Murray Taulagi scored first try after the break with Holmes unable to add the extras from the touchline.
That gave the Sharks the upper hand after Cameron McInnes and Kennedy went in for tries late in the second half.
Raiders send Storm packing
The Raiders repelled a Storm fight-back in the second half to oust the perennial finals heavyweights and march on to a semi-final showdown against Parramatta in Sydney next weekend.
Raiders second rower Hudson Young pounced on a Jack Wighton grubber, which wrong-footed Cameron Munster, in the 65th minute, with Jamal Fogarty adding the extras for the visitors to regain the lead 22-20.
And then an opportunist try by winger Jordan Rapana, when the ball bounced off the head of Sebastian Kris, secured the upset win for the eight-placed Raiders over the fifth-placed Storm.
The Storm trailed 16-8 at half-time and looked down and out, but winger Xavier Coates bagged his third try of the night and then giant prop Nelson Asofa-Solomona crashed over in the 56th minute to put the home side ahead 20-16.
But the gutsy Raiders refused to go away.
Winners on their last four visits to Melbourne, the Raiders kept their composure to reclaim the lead and keep the Storm at bay.
Canberra coach Ricky Stuart's tactics targeted Nick Meaney, who was defending at five-eighth for the Storm, with the Raiders' big men — led by Joe Tapine and Josh Papalii — doing plenty of damage.
The Raiders were starved of territory in the opening stanza but made almost every visit into the Storm's half count.
After weathering some early Storm pressure the Raiders flung the ball wide and young centre Matt Timoko showed his pace and power, palming off Munster to touch down in the seventh minute.
Two tries to Coates put his side ahead 8-4 but the Raiders crossed twice in the final nine minutes of the half to take an eight-point lead into the break.
Halfback Jamal Fogarty and then Elliott Whitehead both punched through flimsy defence, which would have infuriated Storm coach Craig Bellamy.
Coates planted the ball across the line for his third try four minutes into the second half after a break by Marion Seve for the Storm to only trail by two points.
And then Asofa-Solomona's effort put the home side ahead but it was short-lived with the Raiders finishing with a flourish to send the Storm packing.
AAP/ABC