Gregory marked his first Pride Park appearance following his loan move from Stoke by heading home the opening goal and he set up Colin Kazim-Richards for a spectacular second.
Neeskens Kebano gave Boro hope before half-time but Derby stood firm in the second period to secure a victory that boosts their chances of staying up.
Wayne Rooney was looking for a response after Derby's late collapse in their previous game at Rotherham and he got it when his team went ahead in the 15th minute.
Gregory was close to adding a second in the 24th minute when he glanced a header narrowly wide with the visitors struggling to make an impact on another bitterly cold afternoon.
The ball was played quickly up the right and Gregory laid it off to Kazim-Richards who thumped a 25-yard shot that went in off the underside of the crossbar.
But the striker was at fault six minutes later when he lost the ball to Marc Bola who surged into the box and when Derby failed to deal with his low cross, Kebano drove the loose ball past Marshall.
It had given Boro hope for the second half but it was Derby who threatened after the break with Gregory crossing to Kazim-Richards who headed a chance over from 12 yards.
Derby were being pushed back but they almost caught their opponents on the break in the 72nd minute but Jozwiak stumbled on the edge of the area and the ball went through to Bettinelli.
The home side were defending well and for all their possession, Boro had not created a clear chance since Kebano's goal.
That changed in the 87th minute when a cross from the left dropped invitingly to Nathaniel Mendez-Laing 10 yards out but his low shot was blocked.
There was a scare for Derby in stoppage time when Bola swerved past two defenders before going over but his penalty claims were dismissed and the hosts held on for maximum points.