Memphis outscored Miami 9-2 in the final 2 minutes for its second win in the last three.
Rudy Gay finished with 22 points for Memphis, and Mike Conley scored 11. Miller was 12-of-13 from the free throw line.
Ricky Davis had a season-high 24 points to lead Miami. Dwyane Wade , coming off the bench, finished with 18 points, but was 7-of-20 from the field.
Chris Quinn scored 17 for the Heat, while Udonis Haslem added 14 points and grabbed 12 rebounds.
The teams were tied at 92 with 2 minutes left. Gasol scored inside with 1:57 remaining to give the Grizzlies the lead, which they maintained when Wade, a 75 percent free throw shooter, missed a pair from the line with 1:04 left.
From there, Memphis hit its free throws to hold on.
Wade, Shaquille O'Neal and point guard Jason Williams , who have been limited recently by a variety of injuries, dressed but did not start for the Heat. Wade and Williams entered the game in the first quarter, but O'Neal's left hip bursitis kept him on the Miami bench all day.
Memphis led by as many as nine in the second half, but neither team could gain a double-digit lead in the game.
The rest of the stats were just as close, as Memphis controlled the boards 44-37, but 12 of the Heat's were on the offensive glass. Memphis outscored Miami in the paint 42-36, while the Heat shot 46 percent from the field to 47 percent for Memphis.
Miami used a second-quarter rally to take a 46-43 lead into the break. Davis had 11 points to lead the Heat, hitting four of his first five shots.
Memphis missed seven straight shots at one point, contributing to a 13-2 Miami run and a 42-39 lead. Memphis missed 10 of its last 12 shots in the half.
Wade, who sat out Friday's game against Dallas, missed seven of his nine first-half shots. His five points before the break were the only scoring off the Miami bench. Meanwhile, the Grizzlies' reserves managed only two points, and missed eight of nine shots.
Wade was the only Miami play to score off the bench, while Memphis managed only seven points.