Detroit had taken a 78-77 lead with 8:34 left, but Memphis put together a 20-6 run to go up 97-84 with 2:33 left. Gay scored nine in the stretch.
Dahntay Jones added 17 for Memphis, going 6-of-8 from the floor, while Hakim Warrick scored 13 and had eight rebounds. For the second straight game, Lawrence Roberts had double-digit rebounds with 10 in 15 minutes. Gay, the rookie out of Connecticut, has led Memphis in scoring in all three preseason games.
Five Pistons scored in double figures, led by 16 from Jason Maxiell. Flip Murray added 14 and Carlos Delfino had 13. Chauncey Billups was the only Detroit starter in double figures with 10 points, matching the total by Amir Johnson.
The Grizzlies were without starters Mike Miller, who had the nail on his right big toe removed, and center Jake Tsakalidis, who has a sore right knee. Since the Grizzlies cut Kimani Ffriend on Friday, that left 6-foot-8 Brian Cardinal, normally a forward, starting at center.
On the Detroit side, Nazr Mohammed didn't play, so Antonio McDyess was in the middle with Tayshaun Prince and Rasheed Wallace at the forwards. Detroit officials classified Mohammed's night off only as a "coach's decision" before the game.
The Pistons starters were in for most of the third period, but Memphis held a 75-70 lead entering the final period when Jones hit another basket at the end of the quarter.