The Cherries took a 25th minute lead through leading scorer Dominic Solanke before Henrik Dalsgaard equalized for the Bees eight minutes before halftime. Tariq Fosu then scored the winner in the 79th minute.
Brentford are up to second in the EFL Championship table with 41 points, two points ahead with Bournemouth, who remain on 38 points.
Story of the match
Bournemouth were nearly ahead 40 seconds into the match, Jefferson Lerma playing a perfect through ball to Solanke, who saw his shot hooked clear by Pontus Jansson.
Brentford then created their first chances as Ivan Toney fired over after exchanging passes with Sergi Canos while Mathias Jensen went well over his effort.
More good defending by the Bees kept the match scoreless as David Brooks, returning from injury, was denied by the intervention by Rico Henry.
Canos, fresh off of his first career-best trick against Cardiff City, powered past the Bournemouth defense only to drag his shot inches wide.
Jensen then tested Cherries goalkeeper Asmir Begovic with a dipping free-kick from the left side of the penalty area only to see his shot pushed away for a corner.
Brentford were now on the front foot and a minute after Begovic saved from Jensen, he denied Canos from the opposite flank. However, two minutes later, the visitors were in front.
They swiftly worked the ball to Lloyd Kelly, who delivered awkwardly that Solanke rose highest past his marker to beat Brentford goalkeeper David Raya to give Bournemouth a 1-0 lead.
Bryan Mbeumo then floated in a cross for Toney at the far post, but it was just out of his reach. Mbeumo then had a go with Begovic diving low to his right to preserve the Cherries' lead.
Brentford then leveled when Jensen delivered a brilliant in swinging corner to the penalty spot where Dalsgaard got goal goalside of Lerma to head past Begovic.
Toney then tested Begovic with a shot that he easily collected and Jensen went wide as the hosts took all of the momentum into halftime.
The lively Canos then flashed the ball across the six-yard box that the Bournemouth defense cleared before it could reach Toney and then shot well over on Brentford's next opportunity.
On the hour mark, Brooks forced Raya into a save low to his left and provided for Junior Stanislas, who struck a tame effort straight at the Bees netminder.
Substitute Joshua King then stung Raya's palms with a shot before the goalkeeper then collected. Solanke then fed Smith before Pinnock headed behind.
With the game looking to be heading for a draw, the Bees scored the eventual winner as Mbeumo collected Toney's ball on the right side, made space for himself and delivered an impeccable ball that Fosu headed home.
Lerma and King combined to create one of the last chances of this memorable clash with the former blasting over. Begovic then saved from Jensen, the last action of a match that could be looked back on should Brentford go up.
Man of the match: Sergi Canos
While Fosu scored the match-winner, it was Canos who helped to create several good chances after Bournemouth had been on the front foot while having a few of his own. Toney deservedly gets all of the credit for his fine goal-scoring record, but it's the Spaniard who proving himself to be perhaps the most valuable of a slew of great players.
Brentford showed a different side of themselves today
We know how good the Bees are in attack, but their defending while under pressure, the timing of their blocks and interventions and ability to come from behind shows the Bees might just be the most complete team in the division.
Bournemouth failed to turn their pressure into a bigger lead
The Cherries came in as one of the highest-scoring teams in the Championship and they had long spells of sustained attack before and after Solanke gave them the lead. Unfortunately, they failed to expand their advantage for a variety of reasons which in turn decide this vital match.