Gloucestershire 163 (Reece 7-20) and 29 for 2 require a further 150 runs to beat Derbyshire 184 (Reece 59, Miles 5-50) and 157 (Hughes 55*, Higgins 3-17, Miles 3-46)
Derbyshire all-rounder Luis Reece delivered a career-best performance with the ball as 17 wickets fell on the second day of the Division Two County Championship match against Gloucestershire at Derby.
Reece bagged 7 for 20 to bowl the visitors out for 163 but Derbyshire collapsed to 157 with Ryan Higgins taking 3 for 19 and Craig Miles 3 for 46 in his last match as a Gloucestershire player.
Alex Hughes dug in for 50 overs to make an unbeaten 55 to leave Gloucestershire with a tricky target of 179 and New Zealand fast bowler Lockie Ferguson struck twice as they closed on 29 for 2.
Reece had recorded his best figures in the championship the previous day and he preyed on some more undistinguished batting to give Derbyshire a slender first innings lead of 21.
After George Drissell was beaten for pace by Ferguson, Reece secured his first five wicket haul when Jack Taylor edged a ball that moved away.
Higgins was caught at first slip from a lifting delivery by Hardus Viljoen and Reece polished off the tail with Craig Miles edging a big drive before Matt Taylor pulled to mid-wicket.
But Derbyshire were soon in trouble, losing skipper Billy Godleman to David Payne before lunch and Wayne Madsen and Reece to Higgins in the first five overs of the afternoon.
Madsen, who has signed a three year contract extension, was lbw as he moved across the crease and Reece edged to third slip in Higgins's next over.
Tom Lace and Hughes regrouped for 17 overs until Lace was lbw playing back to s full length ball from Benny Howell and two more wickets shortly before tea shifted the momentum towards Gloucestershire.
Matt Critchley was bowled making room against George Drissell and Harvey Hosein edged Miles low to second slip with Derbyshire only 108 ahead.
Hughes at least was showing the application the situation demanded and although wickets fell at the other end, reached a deserved 50 before Matt Taylor finished off the innings to leave Gloucestershire with 10 overs to face before stumps.
The pattern of the game continued as Chris Dent was caught behind off the first ball from Ferguson who then bowled James Bracey to leave the visitors in trouble on 19 for 2.
Miles Hammond and Drissell survived but on the poor standard of batting in the match, Derbyshire are slight favourites going into the third day.