document: The visitors, set 269 to win, opened with a stand of 87 between Mark Wallace (50) and Jacques Rudolph.
  But spinners Graeme van Buuren and Jack Taylor and seamer Craig Miles claimed eight wickets between them in the hour before tea.
  Taylor wrapped up the victory with the final two wickets after the break.
  It was Gloucestershire's first championship victory at their Bristol headquarters for more than two seasons.
  Meanwhile Glamorgan captain Jacques Rudolph confirmed that South Africa fast bowler Dale Steyn, currently playing in the Indian Premier League is trying to complete visa formalities to allow him to sign for part of the T20 Blast campaign.
  Gloucestershire spinner Jack Taylor said: "It was a bit strange, it wasn't spinning too much but we stuck the ball in the right area.
  "They were coming hard, looking to chase the runs and we didn't shell any chances, we took the catches that came our way.
  "They needed three and a half an over and we knew if we bowled tight, it would be difficult for them.
  "They got off to a good start but G (van Buuren) came on and took three quick wickets which was just what we needed, really great."
  Glamorgan captain Jacques Rudolph told BBC Wales Sport: "When Mark (Wallace) and myself had that partnership upfront, I genuinely thought we had a great chance of winning this game.
  "It was a crazy session, we lost ten wickets for around sixty runs on a fairly flat wicket and it's important we have a good look at ourselves. We got ourselves into a winning position and threw it away, we can't afford to do that.
  "It was poor execution, we had guys caught on the boundary, at mid-off and mid-on, and it's difficult to explain.
  "It's hard work at the moment, but we have to re-group and start afresh. I have been in positions like this before and you have to be a bit careful about over-analysing stuff, we've got to stick to the basics."
summary: Gloucestershire earned their first win of the season as Glamorgan collapsed in spectacular fashion on the final afternoon.