It seemed Leeds were cruising to safety when Raphinha put them in front with a second-half penalty and Brentford were reduced to 10 men when Kristoffer Ajer had to go off when the hosts had already used their three substitutions.
But Sergi Canos looped in an equaliser two minutes before he was sent off for a second bookable offence.
With a two-man advantage, Leeds controlled the final stages, although it took Harrison's goal to completely relieve the pressure, with goalkeeper Illan Meslier running the entire length of the field to join in the celebrations and manager Jesse Marsch flat on his back in the technical area as he was swept away by the euphoria.
It means Leeds become the first side since Wigan in 2011 to survive after starting the final day in the bottom three.
Marsch later said: "Hot day - not easy for either team. We got the lead which was important, I thought the start was really good. When we were up two men we still didn't want to leave it up to fate, we tried to push the winner to secure our fate. This group has been able to dig deep in injury time and find goals and the character is clear and it's a privilege to work with these guys.
"We talked about how to play in the heat, how to manage the game, how to stay focussed for every moment. Weird that we gave up a goal when we went up a man. We tried to update the players on the Burnley score but the focus on us was most important. It's hard to concentrate and be connected for 90 minutes on days like this but this is typical of our group - they never stop believing and it's a credit to our mentality.
"It wasn't easy to manage and I was trying to think of ways to help the group tactically and to be fair we have had good performances it's just trying to put it all together hasn't always looked perfect. The stress has been high for three months, I've tried to stay calm and focus on us and you see the quality of the mentality and character.
"There's so much been said about Marcelo Bielsa v me and there's been people counting us out, I get it, this is high level stuff, and fans pay attention all over the world. It's not a perfect representation of what I want this team to be but in this situation we came together well and I still feel strongly about the group we have and the football we can play. We need to get better and add some pieces but I love this group, team, character, commitment and spirit.
"We were with our fans enough and I appreciate the fans singing my name but that's not the important thing. We are Leeds United and that's what we will always be as long as I am here - I love our fans but I don't care if they sing my name. It's important we are a committed group and show us that every time on the pitch."
Need a VPN? Or seeking to switch? Then support Tribal Football by clicking here to sign up with our official partners NordVPN. Not only will you receive the best VPN experience, but also great discounts by signing up via Tribal Football. Thanks for your support!