The Nuggets had lost six out of nine but held off the Grizzlies in a game that saw the teams separated by no more than six points in the second half.
The Nuggets then turned the ball over, giving Memphis a chance to go in front, but Denver's Ty Lawson came up with a steal and the Grizzlies were forced to foul.
Miller hit two free throws with 10 seconds to play, Rudy Gay missed a 3-pointer for Memphis and Miller followed with two more from the line to complete the scoring.
Andre Iguodala scored 20 points to lead the Nuggets, who shot 52 percent from the field. Miller finished with 18.
Memphis has lost three in a row after opening the season with a 14-3 record. This was the second of a three-game road trip for the Grizzlies, who will be in action Saturday in Utah.
Gay paced the Grizzlies with 21 points.