Karlsson also had two assists as San Jose won at home for the first time this season, improving to 1-4.
''It was nice the way it developed,'' Karlsson said. ''I just had to get going, trust Timo (Meier) that he would get the puck there, made up my mind fairly early and stuck to it and it went in, luckily.''
Logan Couture had two goals and an assist, giving him 300 NHL goals.
''It's pretty special,'' he said. ''You don't play this game to reach milestones like that, you play to win. But when those come, I appreciate it for sure.''
Meier added a goal and assisted on the winner. Kappo Kahkonen made 22 saves for his first victory of the season.
''I thought we were intense from the drop of the puck,'' Sharks coach David Quinn said. ''We deserved to win tonight. We deserved the two points tonight.''
Auston Matthews, Mitchell Marner and David Kampf scored for Toronto. Erik Kallgren stopped 27 shots.
''I thought that San Jose's best players gave us a real hard time today,'' Maple Leafs coach Sheldon Keefe said. ''Every time those guys got on the ice, they tilted the ice, so that was a problem for us.''
Couture opened the scoring just 26 seconds into the game, beating Kallgren on a partial breakaway. Kampf tied it a few minutes later.
Couture scored his second on a 5-on-3 advantage to put the Sharks back in front in the second period. Meier netted another power-play goal 42 seconds later, tipping Couture's shot past Kallgren.
Dozens of fans at SAP Center threw their hats on the ice, thinking it was Couture's third goal of the game, but replays clearly showed Meier deflecting the puck for his first goal of the season.
Marner brought Toronto back within one late in the second, beating Kahkonen with 23 seconds left.
Matthews tied it on the power play early in the third, scoring his second goal of the year.
''We'll take the one point that we got here today, feel good about the fact that we found our way back in the game,'' Keefe said. ''But (we) know that we have to play a whole lot better and we can and we will do that.''
Couture became the third player to score at least 300 goals with the Sharks, joining Patrick Marleau (522) and Joe Pavelski (355).
''Whenever you're mentioned in the same breath as Patrick Marleau and Joe Pavelski, it's humbling,'' Couture noted.
CLOSING IN ON 100
Quinn reached 99 victories, improving to 99-94-25 between the Rangers and Sharks.
Maple Leafs: G Ilya Samsonov has been a little under the weather during the current trip, contributing to the decision to start Kallgren. ... F Kyle Clifford (shoulder) was placed on injured reserve Wednesday.
Sharks: F Nick Bonino missed his third straight game with an upper-body injury but is expected to return soon. ''He's close,'' Quinn said.
Maple Leafs: At Los Angeles on Saturday night.
Sharks: Host Tampa Bay on Saturday night.
More AP NHL coverage: https://apnews.com/hub/NHL and https://twitter.com/AP-Sports
Copyright 2023 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.