Fremantle have eased the pressure on coach Ross Lyon after scoring two behinds in the dying minutes to snatch a dramatic one-point AFL win over Sydney at Optus Stadium.
The Dockers entered Saturday night's match on the back of a debilitating four-match losing run, and things were looking bleak when they trailed Sydney by 16 points late in the second quarter.
But in a frenetic final quarter, the Dockers opened up a 13-point lead early in the term before the Swans retook the advantage.
Luke Parker's behind with two-and-a-half minutes to go put Sydney up by a point.
Scores were level when Andrew Brayshaw's shot on the run with less than two minutes to go drifted in for a behind for the Dockers.
And Fremantle were up by a point with 85 seconds remaining when Ed Langdon's snap went through for a behind.
In a tense final minute, the Swans had several half chances to score, but each time their kick was either smothered, blocked, or didn't make the distance.
The 7.10 (52) to 7.9 (51) win improved Fremantle's record to 8-9, keeping alive their finals hopes.
"I thought it was a really strong will to win," Lyon said.
"Tonight both teams fought it out to the end."
Rory Lobb finished with three goals for Fremantle, while David Mundy tallied a game-high 11 clearances.
Jake Lloyd collected 42 disposals for Sydney.
"I thought our execution wasn't quite up to scratch," Swans coach John Longmire said.
"They got on top of us around the clearances (winning that stat 45-23). But our effort in general was pretty good."
Fremantle's recent losing run had seen some fans call for Lyon's axing.
Saturday's win will keep those calls at bay for now, but the Dockers face a crucial match against the Bulldogs at Marvel Stadium next week.
The first quarter made for horrible viewing as both sides made a huge number of mistakes - at times comical.
The Swans won the inside 50m count 16-5 for the quarter, but it equated to just a three-point lead at the first break.
Fremantle dominated the territory battle in the second quarter, but Sydney's efficiency up forward proved crucial as the Swans booted 4.0 to 2.5 for the term.
Lobb booted two goals in the third quarter to drag Fremantle back into the lead.
But the error-riddled nature of the game was summed up by Fremantle ruckman Sean Darcy after taking a strong mark 15m out from goal.
Darcy's set shot slammed into the goal post and then rebounded to hit him on the head while he bemoaned his miss.
That behind put Fremantle up by seven points at the final change, and the Dockers held their nerve in the final few minutes to grind out the win.