Mitchell Marner took a pass from Auston Matthews and shot from the high slot off Rielly, who was in front of goalie Jaroslav Halak at the top of the crease.
"It was two really good players going back and forth with it," Rielly said. "When they're on the ice together, it's great. You just let them do the work, but the win was big. A team within our division and not having John [Tavares]. It was kind of a point in our year where we want to get going, and I think we answered the bell. It was not as clean as we wanted to win, but we'll take it."
[WATCH: All Bruins vs. Maple Leafs highlights]
David Pastrnak tied the game 3-3 for Boston with 4:26 remaining in the third period with a one-timer from the left face-off circle off a pass from Patrice Bergeron.
Dmytro Timashov and Alexander Kerfoot scored, and Frederik Andersen made 43 saves for the Maple Leafs (5-3-1), who have won three of four following a three-game losing streak.
"We want to start stringing some wins together," Andersen said. "We know we haven't been as consistent as we'd like, but this was a good test for us, and hopefully we can build on this."
Video: BOS@TOR: Pastrnak blasts one-timer past Andersen
Jake DeBrusk and Danton Heinen scored, and Halak made 25 saves for the Bruins (5-1-2), who are 2-1-2 in their past five games.
"Obviously, we get one point, but it was disappointing for us because I thought we played well enough to get two points tonight," Halak said. "We played well in the second, we outskated and outshot them, but it just didn't go in. We just have to turn the page, and then get back at it."
Rielly gave the Maple Leafs a 1-0 lead at 5:55 of the first period when his point shot went in off defenseman Brandon Carlo in the slot.
Video: BOS@TOR: Rielly nets one-timer off defender in front
Timashov made it 2-0 at 15:44 when he shot past Halak's glove from the slot for his first NHL goal.
"Of course, it's a dream come true, always a dream to score my first goal," Timashov said. "I didn't think it was going to come this soon because I don't score a lot of goals, I'm more of a passer, but I'm happy to score my first one."
DeBrusk cut the lead to 2-1 with 21 seconds left in the first with a one-timer from the slot off a pass from Charlie Coyle from behind the net.
Boston outshot Toronto 15-3 in the second period, when the Maple Leafs were called for four minor penalties, but neither team scored.
"You just have to keep calm a little bit," Rielly said. "It's easy to get worked up when you're on the penalty kill a lot. They had lots of zone time, but I think it was important to keep calm, and I think we came out in the third and played pretty well."
Heinen tied it 2-2 at 1:36 of the third when he shot past a sprawling Andersen from the right face-off dot on the power play.
Video: BOS@TOR: Heinen buries wrister from circle for PPG
"We weren't happy with our first," Heinen said. "The second was a good bounce-back period for us, and then I thought we had a good third as well fighting back. Now it's just a matter of trying to get a full 60 minutes together."
Kerfoot put the Maple Leafs ahead 3-2 at 2:37 when he jammed in the rebound of Jake Muzzin's point shot.
"It's a big extra point for us," Matthews said. "Obviously this was going to be a statement game, they'd gotten off to a hot start, so we wanted to make sure we came out on time and played well."
Video: BOS@TOR: Kerfoot backhands rebound past Halak
They said it
"It's just kind of the culture of the group. It's something we're really good at, and last year we did it a ton. It's good to see when we're down one, we come back. It's emotional when we tie it up, but we gave up the lead, so that's something we're going to have to make sure we're not doing too often. But to see us keep coming in waves, just play the right way and knowing something good would happen." -- Bruins defenseman Charlie McAvoy
"He was huge for us. I don't think we liked him getting run into a couple of times, but he was solid in there, made some big saves, and kept us in it especially when we weren't playing well in the second period. He had a heck of a game tonight." -- Maple Leafs forward Auston Matthews on Frederik Andersen
Need to know
Maple Leafs forward Andreas Johnsson played one shift after injuring his leg blocking a Carlo shot at 11:05 of the second period. Coach Mike Babcock said X-rays were negative. ... It was Rielly's fourth overtime goal, tying him with Bryan McCabe and Pavel Kubina for second among defensemen in Maple Leafs history (Tomas Kaberle, seven). ... Tavares missed his first game with a broken finger. The center is expected to be out a minimum of two weeks. ... Pastrnak has nine goals, tied with James Neal of the Edmonton Oilers for the NHL lead.
Bruins: Host the Toronto Maple Leafs on Tuesday (7 p.m. ET; ESPN+, TVAS, NESN, TSN4, NHL.TV)
Maple Leafs: Host the Columbus Blue Jackets on Monday (7 p.m. ET; ESPN+, SN, FS-O, NHL.TV)
Video: Rielly leads Leafs past Bruins in overtime, 4-3