Niemi hadn't played a game in a week, limited to backup duty the previous two games because of an injury he sustained when hit by a puck Tuesday during San Jose's morning skate.
Then in the first two periods against Nashville, Niemi was barely tested, facing 11 shots.
But with the Sharks clinging to a one-goal lead, Niemi made 18 saves in the third period, withstanding a furious Nashville comeback bid and leading San Jose to a 2-0 victory at SAP Center.
"I thought he was very sharp when he needed to be," Sharks coach Todd McLellan said. "His week hasn't been easy. He gets injured, misses some starts, comes into a game like that and really doesn't get tested until the third period. He was able to stay in it mentally and physically and made some saves in the third when we needed them."
Niemi made 29 saves for his 29th career shutout, prevailing in a duel against Nashville's Pekka Rinne, a fellow Finnish goaltender. Rinne, who entered the game with a 1.78 goals-against average and .935 save percentage, made 32 saves.
"It was slow in our end for two periods, and we had great chances, so it was exciting to see him making those saves," Niemi said of Rinne. "It's exciting playing one of the top goalies."
The Sharks (17-11-4) have won three games in a row and seven of eight. They have won six straight home games. With 38 points, San Jose is tied with the Vancouver Canucks for second place in the Pacific Division, although the Canucks have two games in hand.
McLellan believes the Sharks are playing their best hockey of the season.
"The record would indicate that," McLellan said. "I think you have to look beyond that. You have to look at the little things you're trying to accomplish, and I'd say we probably are. We didn't talk about it at all, but we just came off playing seven games in 12 nights, which isn't an easy task, but we were able to play four good lines in almost every game; depending on their lineup and who we dressed, we still were able to roll them. You have to do that in this league to have success."
Nashville (19-8-2) finished its three-game road trip 2-1-0.
"They just outplayed us in the first two periods," Predators defenseman Shea Weber said. "We got a push in the third, but it was too late to get one by them."
San Jose outshot Nashville 29-11 through the first two periods. The Predators outshot the Sharks 18-5 in the third.
Nashville's Ryan Ellis made a strong drive to the net and drew a holding penalty on San Jose defenseman Justin Braun at 4:25 of the third. Predators forward James Neal was in front for an attempt off a rebound of a Weber shot from the point, but he couldn't put the puck past Niemi.
"We were too slow tonight in the first two periods," Neal said. "We had a chance to tie it in the third, but it came too late. Our goalie gave us a great chance to win. He was unbelievable all night. It's tough at the end of a road trip when you are playing a good team and you come out flat. This was a game we were looking forward to and wanted the most. It's tough to put a finger on why we didn't feel good out there. And it kind of snowballed."
Nashville coach Peter Laviolette pulled Rinne in favor of an extra attacker after calling a timeout with 1:46 left in the third. Thornton buried a shot for an empty-net goal 12 seconds later to give San Jose a 2-0 lead.
It was the 350th goal of Thornton's career.
The Sharks immediately turned up the heat on Rinne after the opening faceoff, peppering him with a flurry of shots. San Jose outshot Nashville 11-3 over the first 10 minutes, 18-7 for the period. The Sharks won 75 percent of the faceoffs and had five players with multiple shots.
The Sharks took a 1-0 lead when Hertl scored his seventh goal at 5:01 of the first period.
Rinne stopped Joe Pavelski's hard shot from the right circle but couldn't control the rebound. Hertl knifed in to score from close range.
The goal was Hertl's third in the past eight games. Pavelski and Thornton had the assists.
"It was really good," Pavelski said of the Sharks' start. "The last few starts have been where we're used to being, and we were ready today. We knew they're a good team, good goalie, good defense. They don't give up much. Their transition game's good. Those are the things we talked about early and kind of we handled it as we went along."
The Sharks kept up the pressure in the second period, outshooting the Predators 11-4, but Rinne stopped every shot, making a handful of spectacular saves.
"It was hard for us to get it going tonight," Rinne said. "They played extremely well, and we were just hanging on there. They had a lot of speed tonight. They were aggressive on the puck. The whole night they seemed to win every battle."
The Predators got a scare at 4:19 of the second period when Weber checked Sharks forward Tye McGinn into the boards, then went to the locker room with blood on his right arm.
Weber got 12 stitches and returned to the ice with 3:30 left in the second.
"I fell on McGinn's skate, got stitched up and went back out," Weber said. "They did a good job. Thanks to the trainers. It really didn't bother me."
McGinn also was shaken up on the play, hitting his chin on the boards. He went to the locker room but quickly returned to the Sharks bench.