Craig Miles signed off his Gloucestershire career by hitting the winning runs to secure a two wicket victory on a pulsating third and final day of the Division Two match against Derbyshire at Derby.
Miles, who is joining Warwickshire next season, danced down the pitch to strike the winning boundary as Gloucestershire survived a late collapse to reach their target of 179.
Benny Howell looked to have won the game with 58 but four wickets went down for 20 runs before Miles settled the contest with boundaries off leg-spinner Matt Critchley.
Derbyshire looked slight favourites at the start of another glorious early autumn morning but nightwatchman George Drissell set the tone for a determined batting display by surviving the first 10 overs.
Drissell showed good judgement and temperament until he drove loosely at Tony Palladino and was lbw for 16 but the quick wickets Derbyshire needed would not come.
The pitch appeared to have eased but Howell batted confidently from the start although Palladino should have removed Miles Hammond when the opener pulled him to midwicket where Lockie Ferguson spilled the chance.
Hammond only made another four runs but crucially, it was eight more overs before Derbyshire removed him and by then, Howell was set and finding the gaps.
He drove Palladino through the covers for four and on drove the seamer for another boundary and the target was below 100 when Hammond edged a drive at Hardus Viljoen to first slip.
Gloucestershire needed only 64 at lunch and Howell started the afternoon session by twice driving Palladino straight to the boundary to reach 50 from 49 balls.
Derbyshire finally turned to the leg-spin of Critchley and he made the breakthrough in his second over when Howell wedged a drive to point where Alex Hughes held a sprawling catch.
Ben Charlesworth lofted Critchley over mid on for four but was lbw playing back to a leg break and Gloucestershire’s nerves were rattling when Ryan Higgins top-edged a pull at Lockie Ferguson and was caught and bowled.
Jack Taylor clipped Ferguson to the midwicket boundary and steered him to third man for four but was brilliantly caught at cover by Billy Godleman with 10 needed.
But Miles fittingly had the last word, pulling Critchley to fine leg for four before driving him back over head to complete a thrilling victory.