Sydney's 10-game winning streak is over after Fremantle held on by a single point to stamp their own AFL finals credentials.
The Dockers looked destined for agonising defeat after Swans goal-kicker Logan McDonald marked inside-50 with less than 30 seconds on the clock at the SCG on Saturday.
But Western Australian-product McDonald sent the ball across the face of the big sticks after the final siren, leaving Fremantle to edge victory 15.9 (99) to 14.14 (98).
"There's a few more grey hairs poking out towards the end of that game," Fremantle coach Justin Longmuir said.
"Logan didn't score, which was very fortunate for us.
"We take the win but we got a little bit lucky in that last couple of minutes."
The Dockers' midfield unit of Nat Fyfe, Caleb Serong, Andy Brayshaw, Hayden Young and ruck Sean Darcy did what most sides this season have struggled to do and won the engine-room battle against Sydney.
Fyfe was superb against Isaac Heeney, keeping the early Brownlow favourite touchless in the opening 10 minutes, while Young, Serong and Brayshaw shared their duties on Chad Warner.
Serong (eight clearances, 12 contested possessions) stood the tallest in the contest, while Jye Amiss and Sam Sturt spearheaded the attack with three goals each.
The Dockers brought the heat from the first bounce, kicking seven goals to two in the opening term to record their best-ever first quarter at the SCG.
Braeden Campbell and Joel Amartey slotted a major apiece to kick the hosts into gear in the second term but a relentless Fremantle held onto a 27-point lead before the main break.
Sydney then burst to life and kicked eight goals to shave the deficit to 12 points before a rare major from half-back wizard Nick Blakey brought them in touch of the lead.
McDonald levelled the scores with his first goal of the evening before falling short of putting the Swans ahead with the last kick of the game.
"You don't want to get down to that stage in the game," Sydney coach John Longmire said.
"It's a bit of everything, but when we get back to pretty basic footy and we get our pressure up it's amazing what happens from that.
"It's very simple - but we've got to do it a bit earlier."
Key forward Will Hayward sent a scare through the Swans camp after limping off the ground with a right-knee complaint in the first quarter.
He returned to the game after a quick trip to the medical rooms and kicked three goals, helping the Swans stay in the game.
But Sydney will be sweating on the fitness of defender Harry Cunningham, who was subbed off in the third quarter with a tight hamstring.