Derbyshire 242 (Slater 110) and 16 for 2 trail Gloucestershire 331 (Mustard 107*, Dent 94, Palladino 5-74) by 73 runs
Phil Mustard's first century in first-class cricket for nearly five years put Gloucestershire on course for victory in the Division Two match against Derbyshire despite a five wicket haul from Tony Palladino.
Mustard's unbeaten 107 and 94 from Chris Dent lifted Gloucestershire to 331, a first innings lead of 89, and at the close of day two Derbyshire were in deep trouble at16 for 2.
Palladino took his 350th first-class wicket and finished with 5 for 74, the 13th time he has taken five wickets in an innings, but it was Gloucestershire's day.
Derbyshire would have been the side looking to take control when Tom Milnes struck in the second over of the morning before Gloucestershire had added to the overnight total.
Will Tavare was trying to take his bat away but edged to Harvey Hosein and with the inexperienced George Hankins in the middle against a ball only 14 overs old, Derbyshire had the chance to make significant inroads.
But Hankins showed good judgement and sound temperament to stay with Dent for 15 overs until he was bowled by an arm ball from Callum Parkinson for 34.
Gloucestershire were still a long way behind when Hamish Marshall was lbw to Palladino shuffling back and across six overs before lunch but Derbyshire had to wait another 24 overs for the next wicket.
Billy Godleman switched his bowlers around but Dent and Mustard showed patience and selectivity to add 85 for the fifth wicket before Dent tossed away the chance of a century.
He had dispatched Wayne Madsen way back over long on to move into the nineties but when he tried to reach three figures with another big shot off Parkinson, he top-edged to mid on.
Dent knew he had let Derbyshire back in but Mustard and Jack Taylor tilted the advantage towards the visitors with a stand of 74 before the second new ball gave the game another twist.
Taylor chipped to midwicket to give Palladino his milestone and the seamer found just enough away movement to bowl Craig Miles before David Payne edged a drive into his stumps.
When Liam Norwell chased a wide one from Will Davis, Mustard was in danger of being stranded but he pulled Davis for his 13th four to reach an excellent hundred.
Josh Shaw helped add a precious 31 runs before he became Palladino's fifth victim, leaving Derbyshire seven overs to negotiate and they lost Ben Slater lbw to Payne in the first before Billy Godleman edged Norwell to Mustard in the penultimate over.