Derby entered the interval at 1-1 after Jacob Butterfield had cancelled out an own-goal from Richard Keogh, but the Rams conceded three times in the second period - including two from the penalty spot - as they were soundly beaten by Sean Dyche's side.
The visitors again came close in the ninth minute when Tom Ince found space outside the box, but his effort was again saved by Heaton, who was the busier of the two goalkeepers in the early exchanges.
Jason Shackell, who was booed by the home support throughout the match, was next to come close with a header as the half gathered pace, but he missed the target during a period where the home side were struggling for invention in the final third.
Burnley only had one half-chance inside the opening 28 minutes and that was a horribly miscued effort from Scott Arfield.
Against the run of play, the hosts took the lead in the 29th minute when Keogh headed past his own goalkeeper from close range, but Derby were level just 26 seconds later - Butterfield angling past Heaton to stun the home supporters.
Nick Blackman twice had opportunities to send Derby ahead before the end of the first half, but the striker saw a rasping effort deflect just over the crossbar, before missing from close range under pressure from Arfield.
Burnley took the lead for the first time in the match in the 54th minute when Gray converted from the penalty spot after Keogh, who had a miserable night, had brought the home side's No.7 to the ground with a clumsy challenge inside the box.
The home side had another penalty just three minutes later when Shackell handled inside the box and this time Sam Vokes stepped up to beat Scott Carson. It then got worse for Derby in the 66th minute when Arfield's tame strike took a deflection off Shackell and landed in the back of the net.
Ince, whose father Paul Ince was in the stands, had an opportunity to cut the deficit 20 minutes from time, but the attacker fired wide from close range on what was a miserable night for the visitors, who have an FA Cup fourth-round date against Manchester United on Friday.
Burnley, meanwhile, who have not been beaten in any competition since Boxing Day, will travel to Arsenal in the FA Cup at the weekend.