Andrei Kirilenko added 20 points and Vitaliy Fridzon 19 for Russia, which finished ninth at the Beijing Games four years ago.
Manu Ginobili scored 21 and Andres Nocioni 16 for Argentina, which was looking to add another bronze to its Olympic collection after winning one in China and gold eight years ago in Athens.
Fridzon's layup with 5.2 seconds left sealed it for Russia, which came away with the ball after it changed hands several times near midcourt. When the game ended, several Argentine players surrounded referees Bill Kennedy, Jose Carrion and Juan Arteaga in protest and guard Pablo Prigioni kicked an electronic clock off the scorer's table.
Shved, who recently signed with the Minnesota Timberwolves, took over down the stretch for Russia, which had collapsed in the closing minutes and lost to Spain in the semifinals.
After Ginobili's layup gave Argentina, which had rallied from an 11-point deficit in the second half to take the lead, a 77-76 lead with 43 seconds left, Shved countered with a 3-pointer to put Russia back in front.
Nocioni missed a jumper from the corner, but it appeared Argentina might get another chance when Prigioni came up with the ball close to the sideline at halfcourt. But it was tipped away with bodies flying all over the floor and wound up bouncing to Shved, who alertly passed it up the floor for Fridzon, who drove in for his uncontested layup.
As the final seconds ticked off, Russia's players piled on each other in celebration while Argentina's swarmed the three officials, screaming and looking for an explanation.
Ginobili, Nocioni and Luis Scola all complained to no avail and Prigioni sent the substitution clock flying to the floor, an ugly display of sportsmanship by one of the world's best teams.
For the Russians, the bronze felt good.
They came into the tournament an unlikely medal contender, but won their group in preliminary play and appeared on a collision course with the Americans before stumbling in the semis.
This was probably the final game for Argentina's "Golden Generation," a group that became national heroes and gave their country international basketball relevance by beating the U.S. in the 2002 world championships and then again at the Athens Games in 2004, when they won gold.
Ginobili, 35, has already said this may have been his final tournament for Argentina.
Russia used a 12-2 run, highlighted by a 3-pointer and three free throws by Fridzon, to open a 61-50 lead.
But the experienced Argentines fought back, went on a 12-1 run and tied it on Ginobili's bucket with seven minutes remaining.
That's when Shved went to work, the 1.98 metre-tall guard scored 10 points in a row as Russia went basket for basket with Argentina, setting up the wild finish.
Down by six points early in the second quarter, Russia reeled off 12 straight points to open a 33-27 lead. Shved made a 3-pointer to start the run and Kirilenko, who will also being playing with the Timberwolves next season, capped the spurt with a jumper.
Argentina looked flat, the 11 a.m. tip not helping the South Americans' older legs, and it appeared Russia might coast its way to the bronze.
But Leonardo Gutierrez made consecutive 3-pointers, and after a steal in the frontcourt, Ginobili calmly stepped behind the line and knocked down Argentina's eighth 3-pointer of the first half to cap a stirring, 9-0 run in 39 seconds to take a 36-33.
Shved's 3 in the final seconds gave Russia a 40-38 lead at halftime.