SAN JOSE — That one had to hurt.

A gutsy group of Maple Leafs were looking good for at least a point on Tuesday night at the SAP Centre to start a three-game trip.

That didn’t happen.

Tomas Hertl scored the winning goal for the San Jose Sharks at 18:36 of the third period, beating Leafs goalie Frederik Andersen on the short side.

The Leafs lost 3-1, with the third goal coming by Joe Pavelski into an empty net.

Patrick Marleau drew three Leafs to him — defencemen Jake Gardiner and Matt Hunwick and forward Mitch Marner — before feeding Hertl for the winner.

Gardiner especially couldn’t have been more weak on the play.

“We had three people back and they had two and we did not sort it out and they shot it in our net,” Leafs coach Mike Babcock said. “That part is disappointing when you are that close.

“When you hang on like we did, and you give yourself a chance, you have to find a way to get a point for sure. I just think we could have had more guys (playing with more effort).”

Leafs newcomer Brian Boyle, who arrived at the team hotel at 1 p.m., took the game’s opening draw with linemates Matt Martin (who played in his 500th NHL game) and Josh Leivo.

Acquired on Monday in a trade with Tampa Bay, Boyle played 12 minutes 33 seconds in his Leafs debut, won eight of 17 draws he took and had one shot on goal.

“It’s a lot easier meeting the guys, seeing the guys,” Boyle said. “For about 24 hours, you’re on an island, it seems like. You’re not part of quite anything yet.

“It’s a new experience for me, it is difficult, it really is, to be honest. You talk yourself into how exciting it is to be a part of this organization, it speaks for itself, it’s phenomenal, but at the same time it’s difficult.

“But again, we are more than in the thick of the playoff race than I was a day ago, which is really exciting for me.”

Told that former teammate Ryan Callahan tweeted the Leafs were getting “one hell of a teammate,” Boyle said: “I think the league and hockey players in general, we’re cut from a different cloth. It’s really a privilege to be in this league. As young players we learned from older players who really are strong character guys, they bring you in and make you feel comfortable. Cally is a really good example of what it means to be a teammate. You want to be a positive influence.”

Before a crowd of 17,515, Andersen, who was stellar, finished with 34 saves. Martin Jones made 20 stops for San Jose.

The Leafs, who fell to 1-8-2 in their past 11 games against San Jose, remain in the second wild-card spot in the Eastern Conference with 69 points.

Auston Matthews scored his 31st goal in the second period during a Leafs power play — one that he drew, naturally, when he burst to the net and was hooked by Justin Braun — after taking a pass from Leivo.

About 29 of Matthews’ goals have been high-light reel material, give or take one or two, and this one was no different. Once the puck was on Matthews’ stick, it was gone just as fast, rocketing to the top corner over Jones’ catching glove at 6:41.

The goal not only tied Matthews with the Winnipeg Jets’ Patrik Laine for the most among NHL rookies in 2016-17, but it put Matthews three behind Wendel Clark’s team freshman record of 34.

With his explosive ways, Matthews could tie the record during this trip, which includes games in Los Angeles on Thursday and Anaheim on Friday.

With 12 game-opening goals, Matthews has the most for the Leafs since Mats Sundin had 12 in 2002-03. Dave Andreychuk’s 14 in 1993-94 is the team record.

The challenge for the Leafs will be leaving the loss behind, knowing they were less than two minutes from gaining at least one crucial point.

“It’s tough when you are that close and it gets decided that late without getting a point,” Andersen said. “It’s not fun. We have to play 60 minutes to beat these kind of teams.”

Joe Thornton recorded his 999th NHL assist on Pavelski’s goal. Just 12 players have recorded 1,000 assists in the NHL.

tkoshan@postmedia.com

twitter.com/koshtorontosun