A Ruben Neves cracker had secured a point for Wolves after Ben Mee had given the Bees the lead in west London.
But veteran striker Costa took exception to being marked by Mee in stoppage time and was shown a straight red card by referee Bobby Madley.
Madley, officiating in the Premier League for the first time since he was sacked more than four years ago for apparently mocking a disabled person, checked his pitchside monitor before giving Costa his marching orders. It was an explosive end to a match which failed to ignite until the second half.
Ivan Toney may be eager to impress England boss Gareth Southgate ahead of the World Cup but the striker, who has scored six of Brentford's last eight Premier League goals, passed up three decent chances in the opening period.
Toney missed his kick in front of goal after being teed up by Bryan Mbeumo and lost his footing racing on to Vitaly Janelt's through-ball.
Mbeumo found his strike partner again late in the half but this time he trod on the ball and another opportunity went begging. Josh Dasilva also curled a shot narrowly wide for the Bees, who lost Mathias Jensen to a calf injury after half an hour.
Wolves were also forced into a change when Matheus Nunes suffered a shoulder injury but his replacement, Joao Moutinho, immediately volleyed just off target from a corner.
Costa, passed fit despite suffering a knock in training on Wednesday, then got on the end of a Daniel Podence cross but his header flew over.
With the forwards all misfiring it was centre-back Mee who took matters into his own hands at the start of the second half when, from a short corner, he acrobatically turned in a cross from Mbeumo.
It was a spectacular goal which Toney would have been proud of, but it was cancelled out just 110 seconds later. Nelson Semedo collected the ball from Adama Traore and squared to Neves, who crashed a superb first-time effort past David Raya from the edge of the box.
Costa had the best chances to win it for the visitors when he twice wriggled his way into shooting positions but Bees keeper Raya made two fine saves.
The Portuguese frontman's frustration got the better of him when he shoved his head into Mee's and was sent off following a VAR check.
Additional reporting by PA.