The play wasn't even set up for Gay. The first option was for the inbounds pass to go to Mike Miller, who led the Grizzlies with a season-high 31 points. But Miller was guarded, so Gay fired from 27 feet.
"I had Tim Duncan on me, and he really didn't get to me fast enough. I put it up, and it went in," Gay said. "You've always got questions when you take a shot like that, but it felt good, and that's all you can say."
Manu Ginobili's dunk with 2.4 seconds left tied the score at 85. After a Memphis timeout, Juan Carlos Navarro threw the inbounds pass to Gay, who dribbled toward the top of the key and got off a shot as the horn sounded, handing San Antonio its third straight road loss.
The last time the Spurs dropped three in a row away from home was in April 2005.
Duncan expected Gay to try and get closer, and that gave the forward enough room to shoot.
"I think he got a little too comfortable," Duncan said. "I thought he would take at least one more dribble in, and I could contest something at the top of the key. Instead, he pulled a 3 (with) a hand up, and the rest is history."
Miller shot 12-of-18 from the field, and Gay finished with 23 points. Damon Stoudamire and Navarro had 10 points apiece.
The Grizzlies held on despite squandering a 23-point lead and scoring only 12 points in the fourth quarter.
"Clearly, the minutes we played our guys started to show," Memphis coach Marc Iavaroni said. "I think that had a lot to do with the turnovers in the fourth, and the tightening of the nerves."
Memphis, ahead by 23 in the third, had the margin cut to 84-83 after 11 unanswered points by the Spurs. Duncan scored inside twice during the stretch, and San Antonio had a chance to complete the comeback after Ginobili scored in the closing seconds.
Gay's game-winner was reviewed by officials before they ruled it good.
"He made a desperation shot, and it went in, so you give him credit," Spurs coach Gregg Popovich said. "Tim was right there to contest it, and sometimes shots go in, and you win games like that."
San Antonio played its fourth consecutive game without starting point guard and leading scorer Tony Parker, who has a sprained left ankle. Memphis was without its leading rebounder and second-leading scorer, Pau Gasol, who missed his fourth game with a jammed right big toe.
The Spurs won nine of the previous 10 meetings. Memphis' only victory during that stretch came in April when Duncan, Parker and Ginobili sat out a game to rest for the playoffs.
San Antonio's comeback was keyed by strong, pressure defense, which forced seven turnovers in the fourth quarter. But the Grizzlies still managed to win for only the second time in nine games.
Memphis held a 49-35 lead at halftime behind 16 points from Miller. Duncan had 10.
For the second consecutive game, Memphis started out shooting well, connecting on 63 percent of its shots midway through the second quarter. That contributed to a 20-6 Grizzlies run spanning the first and second periods.
Meanwhile, San Antonio was hitting only a third of its shots at that point, including missing 13 of its first 16 attempts in the second quarter, helping the Grizzlies build a 21-point lead. The Spurs ended up shooting 41 percent for the game compared to 44 percent for Memphis.
Ginobili, who entered shooting 34 percent over the previous five games, missed his first six shots, finally hitting his only field goal of the first half in the closing seconds before the break.
"There's no excuse for how we played in the first half," Ginobili said. "We played so soft. There are too many good teams that are talented, and when they get momentum, it becomes really hard to beat them."
Ginobili got going after halftime, scoring 12 points in the third. But Memphis' 3-point shooting with Miller and Navarro rebuilt the lead to 23 before the Grizzlies carried a 76-59 lead into the fourth.
"We dug a hole that was too deep to get out of," Duncan said. "We just ran out of time, I guess."
- The Grizzlies announced before the game that Eric McMahon, who dresses as the team's mascot, Grizz, is taking an immediate leave of absence after being diagnosed with Hodgkin's Lymphoma. Team officials said they would not replace McMahon, meaning Grizz will not be making any game or community appearances as McMahon undergoes treatment.
- Memphis is 1-6 in games decided by three points or less.
- San Antonio is 1-3 since Parker's injury.