The Bruins seemed destined for elimination in their Eastern Conference quarterfinal series after going down 4-1 in the third period, but then staged a historic comeback.
Nathan Horton began the rally with a goal 9:18 into the final frame.
Thirty-two seconds later, Bergeron drew Boston even with a wrist shot past James Reimer from the high slot.
Six minutes into the overtime, Boston center fired in a loose puck from the right circle, and the Bruins had the stunning win, becoming the first team in NHL history to rally from three goals down in the third period to win a Game 7.
Rask finished with 24 saves for Boston, which will meet the New York Rangers in Round 2.
Cody Franson scored twice and Reimer made 30 saves for the Maple Leafs, who were trying to pull off win after trailing the series 3-1.