Tom Curran's 51 off 27 balls revived Surrey's chase despite Marchant de Lange's 3-29.
Earlier Aneurin Donald's career-best 76 off 40 balls led the visitors to 181-6.
He added 95 in 8.3 overs with Colin Ingram (42), before Surrey put the brakes on with three quick wickets.
One of Ingram's three sixes went out of the ground, but Donald stole the show before Rikki Clarke, back after nine years away, took 1-23 and Tom Curran 2-25 in a canny four overs apiece.
Surrey got off to a fine start through Aaron Finch (33) and Mark Stoneman (34), and they kept swinging despite losing quick wickets in the middle overs.
Tom Curran's lusty hitting put Surrey in with a chance, needing 17 off the last over and nine off four balls, but Michael Hogan found his length to deny the home side victory.
Glamorgan batsman Aneurin Donald told BBC Wales Sport:
"It was a great night and again we played some awesome cricket.
"To do it under such a high-pressure situation with 20,000 fans here makes it even sweeter.
"We've played pretty well here the past few years and it's nice to do over a good team again."
Glamorgan held their nerve in the field for a six-run victory to remain unbeaten in T20 cricket at the Oval, as a target of 182 proved too much for Surrey.