The Raptors took a three-point lead with 1:09 remaining on Alan Anderson's long-range shot, but Atlanta held Toronto scoreless the rest of the way.
Horford's two foul shots with 59 seconds left brought the Hawks within one, after which John Lucas missed a jumper for the Raptors.
After a time out, Atlanta worked the ball to Horford for his game-winning slam. Horford then blocked a layup attempt by Kyle Lowry and also blocked a would-be layup by DeMar DeRozan just before the buzzer.
DeRozan made half his 16 attempts from the field and scored 23 points for Toronto, which has dropped three in a row.