The Swans saw off a Brentford fightback to claim a 3-2 victory and end their three-match losing run in a thrilling game at Griffin Park.
Graham Potter's side had raced into a 3-0 lead within 27 minutes, with Wayne Routledge tapping them ahead after just 33 seconds.
A Chris Mepham own goal after 22 minutes doubled the advantage before captain Leroy Fer directed home Oli McBurnie's effort five minutes later.
But the Bees weren't finished, and they cut the deficit through Ollie Watkins on the stroke of half-time.
Said Benrahma curled home a fine free-kick with 20 minutes left, and the Swans had to count on the crossbar to deny the hosts an equaliser in the final moments.
The final whistle was met with huge cheer from the 1,600-strong travelling support, with victory moving the Swans onto 29 points from 21 games.
Potter made six changes to his starting XI with experienced wingers Routledge and Nathan Dyer both recalled.
Routledge made only his third start of the season and Dyer his second, but the two wideman would play their part in a timely win.
Full-backs Kyle Naughton and Martin Olsson were also back in the XI along with Barrie McKay and Fer.
Connor Roberts, Declan John, Cameron Carter-Vickers, Jay Fulton, Bersant Celina and the injured Daniel James all dropped out of the team which began the defeat at Derby.
The Swans made an electric start as Routledge tapped in McKay's low cross from close range.
It was the perfect way for Potter's side to get going, though they lost Olsson through injury with the Sweden international stretchered off in the 14th minute.
Despite that setback, the visitors pushed on and soon doubled their lead.
Dyer, McKay and McBurnie linked up before Dyer's cross was turned into the net by Wales defender Mepham.
Remarkably, it got even better for the Swans as the travelling supporters were given more reason to cheer.
With 27 minutes gone, Routledge's Rabona cross found McBurnie, and his overhead kick was poked in by Fer.
The home side were stunned, but they went close to reducing the deficit through Benrahma, who struck the top of the crossbar with a thunderous effort.
At the other end, Joe Rodon was denied from close range as his header from McKay's corner was tipped wide by Daniel Bentley.
The hosts, though, kept plugging away and Neal Maupay was sent in on goal only for Mike van der Hoorn to slide in and block the striker's effort.
The warning signs were there, and Brentford pulled one back on the stroke of half-time as former Swans loanee Josh McEachran rifled a 20-yarder towards goal. Erwin Mulder tipped it onto the bar but Watkins headed home the rebound.
That was the end of the action in a thrilling first half, and there was plenty more to come after the break.
Both teams continued to create chances, with McKay denied by Bentley before Fer headed over from close range after Routledge crossed into the box.
Sub Connor Roberts then struck the post after he latched onto McKay's backheel pass, and then van der Hoorn clipped the crossbar with a header.
Dyer then teed up Fer for a strike at goal, but the Dutchman's sidefooted effort was padded wide by Bentley.
The Swans kept pushing on, and another chance went begging as some fine work by Routledge, who linked with McBurnie down the right, led to his cross finding the onrushing McKay, but he could only shoot wide as he stretched.
The fear was that the missed chances would come back to haunt the Swans, and Brentford had a golden chance to cut the lead further when Maupay found himself in the box just a few yards out, but Mulder denied the striker.
A minute later, though, Brentford weren't to be denied.
Benrahma stepped up to take a free-kick and curled it inside the near post with Mulder left stranded.
With 20 miuntes left, there were some tense moments ahead.
Romaine Sawyers drilled a powerful effort wide as the strong wind pinned the Swans back in their own half.
The Swans had to roll their sleeves up for the remainder of the game, but they were lucky to see sub Sergi Canos' effort in additional time strike the crossbar.
Thankfully, though, they had done enough to see off Brentford and hold on to their lead to claim a dramatic win.
Brentford: Daniel Bentley, Rico Henry, Chris Mepham, Ezri Konsa, Henrik Dalsgaard, Josh McEacharan (Alan Judge, ht), Nico Yennaris (Kamo Mokotjo, 70), Ollie Watkins, Romaine Sawyers (capt), Said Benrahma (Sergi Canos, 77), Neal Maupay.
Subs: Luke Daniels, Moses Odubajo, Josh Dasilva, Yoann Barbet.
Swans: Erwin Mulder, Kyle Naughton, Mike van der Hoorn, Joe Rodon, Martin Olsson (Connor Roberts, 14, Matt Grimes, Leroy Fer (capt), Nathan Dyer (Jay Fulton, 67), Wayne Routledge (Cameron Carter-Vickers, 78), Barrie McKay, Oli McBurnie.
Subs: Kristoffer Nordfeldt, Bersant Celina, Jefferson Montero, Wilfried Bony.