It marked the third straight time the Cardinals had beaten San Diego by a field goal. The last time came in the 1998 season finale, when Chris Jacke booted a 52-yarder as time ran out, giving the Cardinals a 16-13 victory and a berth in the playoffs.
The Chargers tied the game with just 1:54 left when Doug Flutie connected with Jeff Graham from 28 yards out on the right side of the end zone.
But rookie Marcel Shipp returned the ensuing kickoff to the Arizona 36 and the Cards took eight plays to advance to the San Diego 24 with six seconds left, setting the stage for Gramatica's winning kick.
It was San Diego's (5-6) fourth straight loss after getting off to a 3-0 start. The Chargers remain in fourth place in the AFC West.
"I know I get credit but for me, I would give the offense and defense and the rest of the team all the credit," Gramatica said. "And if it wasn't for them, I wouldn't be standing here."
"This one is really hard to take," Chargers coach Mike Riley said. "Not taking advantage of points when we had the chances was big in the ballgame."
After missing on a 25-yarder with 4:31 left in the opening quarter, Wade Richey connected from 26 yards out just under three minutes later, putting the Chargers ahead 3-0.
San Diego squandered another scoring opportunity when Richey missed again from 27 yards with 5:42 left in the second quarter.
"We have been working with Wade and have been very supportive in every possible way," Riley said.
"He's going to come back," Gramatica said.. "He's a great kicker."
Jake Plummer needed just six plays to march the Cardinals 80 yards, capping it with a 37-yard touchdown to David Boston.
Plummer threw for 241 yards and two touchdowns, completing 19 of 31 passes, and has thrown for 575 yards over the last two games.
Boston caught six passes for 121 yards and has 1,065 receiving yards this season, becoming the sixth player in franchise history to record consecutive 1,000-yard receiving seasons. He also tied Roy Green's 1984 club mark for the fewest amount of games (10) to 1,000 yards.
"Anytime you win a game on the road like this, it gives your team confidence," Boston said. "I'm getting open because I'm running good routes, not because of my athletic ability and I think that's helping me out this year."
Gramatica booted a 18-yarder just under five minutes into the third quarter, putting the Cardinals ahead 10-3. On the ensuing possession, Chargers rookie running back LaDanian Tomlinson lost the ball at his own 35 when he was tackled by safety Kwamie Lassiter. Middle linebacker Ron McKinnon recovered for Arizona.
Plummer attempted a pass from the 12 to tight end Steve Bush in the end zone, but safety Jason Perry stepped in front and intercepted the ball at the one with 7:13 left in the third.
"I had Bush coming across, he catches it maybe for five or six yards," Plummer said. "But the guy (Perry) just barely got a finger on it."
Flutie completed his next 11 passes on the drive, which ended when he found Curtis Conway in the right corner of the end zone, tying the game with 14:24 left. It was Conway's fourth touchdown reception of the season.
"They were plying zone and they backed off," Flutie said. "You have to be patient and nickel and dime them. Sometimes, that means you dump the ball off on third and eight and hope the guy can run for the first down."
The teams exchanged punts before Arizona took over at its 32 with 9:49 left.
Michael Pittman took a handoff at the Charger one 3:05 later and ran up the middle for a 17-10 Cardinal lead.
But the Chargers weren't finished.
Ronney Jenkins returned the ensuing kickoff to the San Diego 28 with 5:46 to play. Five plays later, after a holding penalty on guard DeMingo Graham moved the ball back to the 36, Flutie completed a 26-yard pass to Trevor Gaylor to give the Chargers a first down at the Cardinals' 38.
Flutie then connected with tight end Steve Heiden for 30 yards to the eight, setting up Tomlinson's touchdown three plays later.
Flutie passed for 326 yards on a career-high 33 completions on 44 attempts. Tomlinson rushed for 75 yards on 21 carries and caught 13 passes for 72 yards.
"I think this one is the hardest (losses) because this is one that we had to have," Tomlinson said. "Four losses in a row, I can't even put it into words."
2014: The Year in Music [PHOTOS]