Glamorgan 526 for 9 dec (Lloyd 119, Marsh 111) and 85 for 4 beat Gloucestershire 236 (de Lange 5-62) and 372 (Bracey 120*, Higgins 61, Worrall 50, Carey 4-105) by six wickets
James Bracey's second Specsavers County Championship century was not enough to save Gloucestershire from a six-wicket defeat by Glamorgan at Bristol.
Bracey, the 20-year-old left-hander, battled away for seven hours and 28 minutes to make an unbeaten 120, receiving excellent support from Ryan Higgins (61), Dan Worrall (50) and Matt Taylor (48), all three career-bests, as the hosts fought their way to 372 all out.
That set Glamorgan 83 to win in 21 overs. Nick Selman led the way with 36 as his side posted 85 for 4, Aneurin Donald ending the game with a six in the 13th over, and took 22 points to Gloucestershire's two.
"It was really disappointing in the end because we were just a few overs away from saving the game," Bracey said. "We had to work really hard just to give ourselves a chance of avoiding defeat and the lads in the lower order really stuck it out with me.
"We all had to dig in, while taking a few chances to score our runs. In Marchant de Lange they had a bowler who was he difference in the match, with that little bit of extra pace and bounce.
"I pride myself on batting time. We have lads around me who are more fluent batsmen, scoring at a quicker rate, but I think it is a real asset in the four-day game to occupy the crease and build around that."
The day began with Gloucestershire 133 for 5, needing 157 to make the visitors bat again. Bracey, who was on 34, and Higgins comfortably negotiated the first 45 minutes.
Glamorgan skipper Michael Hogan made the breakthrough with the total on 184, trapping Higgins lbw playing half-forward. Gloucestershire's winter signing from Middlesex had faced 76 balls and hit eight fours. The stand with Bracey, whose half-century occupied 141 deliveries, was worth exactly 100.
Kieran Noema-Barnett contributed 12 before dragging a ball from Carey onto his stumps and departing with the total on 205.
Bracey remained unruffled, even when, with his score on 57, Shaun Marsh claimed a catch at square-leg off a pull-shot, the umpires ruling that the ball had not quite carried.
"We thought we had Bracey caught by Shaun Marsh, but the umpires decided otherwise and that's all I can say about it," Hogan said
Lunch was taken at 239 for 7. Early in the afternoon session Worrall, on 27, was dropped by Marsh, top-edging a sweep off Andrew Salter.
Worrall moved to his half-century off 71 balls. The Australian had gone into the game with a highest first class score of 26 and bettered it in both innings.
Glamorgan took the second new ball with their opponents on 253 for 7, needing a further 37 to avoid an innings defeat. Worrall was bowled off an inside edge by Carey to make it 285 for 8.
Taylor got off the mark with a leg-side boundary off Carey and when Bracey took a single off Hogan the scores were level. It was hard going for the bowlers as the pitch had died and even the new ball barely carried through to the wicketkeeper.
Bracey remained commendably patient, showing immaculate defence as he moved to a hundred off 273 balls, with 14 fours.
Taylor was excellent in support and by tea the pair had added 60, with Gloucestershire 340 for 8 and leading by 40 runs. Their stand had reached 77 in the final session when Taylor, two short of his maiden half-century, edged a ball from offspinner Salter and was caught behind.
Liam Norwell, carrying a hamstring injury, walked out with a runner, his side on 362 for 8 and leading by 72. He helped Bracey add ten more runs before being caught behind off a short Hogan delivery.
Glamorgan were left needing to score at around four an over, a task which proved well within their capabilities, even though Jack Murphy and Marsh were caught behind down the leg side, while Kiran Carlson and Selman skied catches to deep square.