But a four-minute stretch in the fourth quarter made everything all better.
The Magic went on a late 16-0 run, led by the shooting of Ryan Anderson -- who finished with 24 points -- to erase a double-digit deficit and defeat the Raptors 102-96.
Orlando shot 4 for 5 from 3-point range during the burst, with Anderson making two of them, as the Magic took a 94-89 lead with 3:05 left after trailing by as many as 16 points.
"We sort of could've just given up, but we kept pushing through it," Anderson said. "This was huge for us."
|More on Magic-Raptors|
Dwight Howard had 19 points and 15 rebounds for the Magic, who have won four straight since a season-opening loss to Oklahoma City. J.J. Redick added 21 points and Hedo Turkoglu had 15 points and seven assists.
"I thought we played a great fourth quarter," Magic coach Stan Van Gundy said. "Our intensity level went way up."
Bargnani paced the Raptors with 28 points, and Jose Calderon had 18 points and 13 assists.
It was the second consecutive late collapse by the Raptors, who also gave up a second-half lead to Dallas on Friday.
"I don't really have an explanation as to why this game got away," Calderon said. "It's tough. It's kind of like the same thing that happened with Dallas. They're two veteran teams. They know how to play in those moments. We've got to learn from that."
Bargnani, who scored only three of his 28 points in the fourth period, was disappointed with his team's showing.
"We really made the game for three quarters; we played good offense and great defense," he said. "But we didn't play that way in the fourth quarter. We played really bad."
The Magic shot 44.4 percent from 3-point range and were 5 for 7 from long range in the fourth quarter.
After the Raptors built another double-digit lead in the second half and looked to be on their way to a road upset, the Magic shots began falling while the Raptors' offense stalled.
Turkoglu made a layup to cut the Raptors' lead to 89-80, then Anderson and Redick made 3-pointers. Howard converted a layup off a pass from Jameer Nelson, followed by 3-pointers from Anderson and Turkoglu to force Toronto into a timeout down 94-89.
The Raptors missed all five of their shots and committed three turnovers during the run. They didn't score between the 7:48 and 2:47 marks of the fourth quarter.
"It was the defensive end of the floor," Van Gundy said. "You're not going to come close to trading baskets and get back in the game, so you obviously have to make plays at both ends. You have no margin for error. But your defense has got to be great, and ours was going down the stretch. To be down 11 going into the fourth and get that done, we played a great game in the fourth quarter."
The Raptors took a double-digit lead late in the first quarter behind some strong shooting from Calderon and Bargnani. The Magic responded, going up 40-39 after a 12-2 run midway through the second quarter that included eight points from Anderson.
Bargnani led all scorers with 19 points after two quarters of play.
|Jason Richardson and the Magic erase a 16-point fourth-quarter deficit to beat the Raptors. (Getty Images)|
|Orlando (4-1) «||18||29||23||32||102|
|TOR:A. Bargnani 28 Pts
TOR:A. Bargnani 7 Reb
TOR:J. Calderon 13 Ast
|ORL:R. Anderson 24 Pts
ORL:D. Howard 15 Reb
ORL:H. Turkoglu 7 Ast
|Players of the Game|
Jameer Nelson Magic Net Number Player T-Shirt - Black Shop Now!
|A. Bargnani, C||41||10-21||7-7||7||3||1||28|
|J. Calderon, PG||36||6-9||3-3||4||13||1||18|
|D. DeRozan, SG||36||4-12||8-9||6||0||3||17|
|A. Johnson, SF||25||3-5||2-2||2||0||4||8|
|R. Butler, SG||19||0-2||3-3||1||1||3||3|
|L. Barbosa, SG||27||3-8||3-4||2||1||6||9|
|J. Magloire, C||17||3-3||1-1||6||1||5||7|
|A. Carter, PG||14||2-5||0-0||3||0||0||4|
|J. Johnson, PF||12||0-1||0-0||1||4||2||0|
|E. Davis, PF||12||1-4||0-0||1||0||2||2|
|G. Forbes, SF||1||0-0||0-0||0||0||0||0|
|L. Kleiza, SF||Did Not Play|
|A. Gray, C||Did Not Play|
|J. Bayless, PG||Did Not Play|
|S. Alabi, C||Did Not Play|
|Complete Box Score|
|D. Howard, C||43||7-11||5-9||15||1||4||19|
|H. Turkoglu, SF||34||6-14||1-1||2||7||5||15|
|J. Nelson, PG||32||4-7||0-0||0||4||2||9|
|R. Anderson, PF||30||9-16||1-1||5||2||3||24|
|J. Richardson, SG||28||1-8||2-4||5||1||1||5|
|J. Redick, SG||34||6-10||6-7||3||3||3||21|
|G. Davis, PF||20||3-6||1-2||3||0||3||7|
|C. Duhon, PG||16||1-3||0-0||0||2||0||2|
|E. Clark, SF||2||0-0||0-0||0||0||1||0|
|L. Hughes, SG||Did Not Play|
|Q. Richardson, SG||Did Not Play|
|V. Wafer, SG||Did Not Play|
|J. Harper, PF||Did Not Play|
|D. Liggins, SG||Did Not Play|
|D. Orton, C||Did Not Play|
|Complete Box Score|