The lead changed hands several times in the second half of an eight-try affair, after the score had been just 9-7 to the Blues at half-time - with three Gareth Anscombe penalties cancelling out James King's converted try.
But after they extended their advantage through Aled Summerhill, a Hanno Dirksen double hauled Ospreys back into it and the tries kept on coming.
Josh Navidi and Sam Underhill traded scores before another Anscombe penalty, but Webb had the final say with his late double handing Ospreys five much-needed Guinness PRO12 points.
"We came into this knowing we needed to win and knowing we needed to score four tries," Webb told the Ospreys website.
"The boys have been positive the last couple of weeks, we don't want to be where we are in the league at the moment, but we just want to go out there and express ourselves.
"The way the boys played today, especially in the second half, it's all credit to the coaches and the boys for getting that result.
"I felt very proud at the final whistle because the Blues have been going well and everybody had written us off for this game.
"It was a huge effort by the boys and it keeps it alive for the final week.
"I am not looking towards the Wales tour this summer at all. I am only thinking about the Ospreys. We have one game left and whatever happens will happen."
Ospreys now face a key home clash with Ulster at the Liberty Stadium next weekend, where only another bonus-point victory will do if they are to overhaul Munster in the race for the all-important sixth spot in the Guinness PRO12.
Webb added: "We don't want to be where we are, but we haven't given up yet. After the Scarlets game we knew we'd pretty much have to win every game with a bonus point, four tries, and we've done that the last three games.
"We've got one more game next week now and we've got to take everything good we did today into that and hopefully results will go our way.
"We aren't giving up. We're a positive bunch of boys here, we want to go out and play."
To buy tickets for the Guinness PRO12 Grand Final click here. Also follow us on Facebook, join the conversation on Twitter, sign up to our YouTube channel for extensive match highlights and sign up for our newsletter for regular updates on the Guinness PRO12.