Pavelski's second goal, his 27th of the season, came in the second period during the game's only power play and broke a 2-2 tie.
Niemi made the lead hold up in the final period as he posted 11 of his 21 saves, securing the Sharks' fourth straight win.
Tommy Wingels also recorded a goal for San Jose.
Kevin Westgarth and Jiri Hudler each scored for the Flames, who were coming off a brawl-filled shootout loss to Vancouver Saturday and fell to 3-13-2 in their last 17 games.
Flames Coach Bob Hartley was fined $50,000 for his role in Saturday's melee. He was cited by the NHL for sending out Westgarth to instigate a fight during the game's opening face-off.
Karri Ramo stopped 24-of-27 shots.
Aaron Carter is still in love with Hilary Duff
Millions of Getty images now available for free via embed tool