Allen had missed 11 of his previous 14 shots in a flat performance for the Celtics, yet hit nothing but net on the jumper from the left wing, setting off a wild celebration for the Celtics, who won their third straight game and improved to 11-1.
Paul Pierce scored 23 points and Kevin Garnett had 23 points and 11 rebounds for the Celtics, who had gone more than 3 minutes without scoring until Allen's bucket.
Richardson had 25 points and Raymond Felton had 18 points and nine assists for the Bobcats, who lost their third straight game.
A night after the Celtics cruised past the Los Angeles Lakers amid hype in Boston over a possible renewal of their 1980s rivalry, the Celtics had little energy against the fourth-year Bobcats, who were playing without injured top scorer Gerald Wallace.
With Allen struggling, they trailed at halftime for the only the second time and the first since their lone loss to Orlando. Boston trailed by five early in the fourth quarter, and made key mistakes down the stretch.
Down 95-93, Rajon Rondo threw the ball away with 1:12 left.
Felton had his shot blocked at the other end, but Pierce missed a straightaway 3-pointer. Felton lost the ball on the ensuing possession, leading to a shot clock violation with 16.6 seconds left.
Pierce then missed a foul-line jumper. The Celtics committed a foul, but were not over the limit. That forced Richardson to inbound from the backcourt, and led to Allen's 3-pointer.
There was a brief pause in the Celtics' celebration, as they reviewed the replay, but Allen released the ball well before the buzzer.
Allen finished with 14 points on 4-of-15 shooting. The game-winning 3 was his only make in six 3-point attempts, and it spoiled an impressive performance by Bobcats rookie Jared Dudley. The former Boston College star had 11 points and nine rebounds filling in for Wallace.
Wallace played only 12 minutes in Charlotte's loss to Orlando on Friday after straining his right calf. He underwent an MRI Saturday afternoon. When the Bobcats found out about 45 minutes before tipoff that the results were negative, Wallace was inserted into the starting lineup.
But Wallace had discomfort warming up, and Dudley replaced him at small forward, assigned to Pierce.
Dudley held his own early, as the Bobcats used runs of 13-0 and 8-2 to take a 53-48 halftime lead.
There were nine lead changes in the third quarter, before the Bobcats went ahead 85-80 with 9:03 left behind 3-pointers from Matt Carroll and Richardson.
Yet the Celtics, who shot only 44 percent and were outrebounded 41-34, found a way to win.
Celtics G Tony Allen left in the second quarter with a bruised right thigh and did not return. ... While an MRI on Bobcats C Ryan Hollins' injured left shoulder came back negative, he did not play and his arm was in a sling. ... The Bobcats had their first sellout of the season. ... Saxophonist Branford Marsalis performed the national anthem.