Matt Cullen scored a breakaway goal in the final second of the opening period, and Martin Straka also scored as the Rangers got their third victory in four West Coast games. Weekes lost his shutout bid on Kyle McLaren's goal with 2:24 to play, but was outstanding for the second straight night after playing just one previous game all season behind starter Henrik Lundqvist.
After beating Anaheim on Wednesday, Weekes knocked off another Pacific Division power despite San Jose's superior offensive pressure and a 30-19 shot advantage that seemed even larger.
The Sharks missed several scoring chances in the final seconds before Brendan Shanahan scored an empty-net goal that banked off the boards near the New York bench and somehow went all the way in with 3.6 seconds left. The bizarre goal was the 610th of Shanahan's career, tying him with Bobby Hull for 12th place on the NHL's career goal-scoring list.
It was the first meeting between Joe Thornton and Jaromir Jagr since they finished 1-2 in the NHL's Most Valuable Player voting last summer, but neither superstar did much.
Evgeni Nabokov made 16 saves but got little support as the Sharks returned from a successful five-game road trip by picking up exactly where they left off in a one-sided home loss to Minnesota nearly two weeks ago. Fans booed the Sharks' normally potent power play as it went 0-for-5.
San Jose largely dominated the first period, but the Rangers scored in the final instant when Thornton and two defencemen got caught in an awkward pinch and gave up Cullen's breakaway. He beat Nabokov with 0.7 seconds left for his fourth goal of the year.
New York got another early in the second period, again thanks to a San Jose defensive lapse. Nabokov made a pad save on Straka's first unobstructed shot, but Straka flipped the rebound off the back of the goalie's leg and into the net for his seventh goal of the season.
Thornton and Jagr rarely interacted until late in the second period, when Thornton fumbled the puck right onto Jagr's stick deep in San Jose's zone. Nabokov fended off the Rangers star with an extended pad, but Thornton seemed embarrassed - although Jagr committed a tripping penalty moments later to negate a Rangers' power play.
After San Jose dominated the third period, McLaren scored a fluke goal with a long, high shot from the boards that somehow eluded Weekes.
Notes: New York hosts Buffalo at Madison Square Garden on Sunday, then heads out for another three-game road trip. The Rangers are in the midst of a stretch with nine of 11 games on the road. ... San Jose won three of five games on its second-longest road trip of the season, but has two more four-game trips on its schedule before mid-December. ... Golden State Warriors G Baron Davis watched the game from a rinkside seat.