With his wife, Louise, by his side, Scanlon looked on as his campaign manager, Joyce McMahon, posted the results on a screen as they came in ward by ward. The race was too close to call until campaign worker Matt Gelineau emerged with the report from Ward 4, which Scanlon won by 236 votes.
"We won!" Gelineau yelled, and the crowd erupted in applause.
Scanlon said even a poll conducted by his campaign showed him losing.
"If a couple of hundred votes had turned the other way, we would've lost this thing," he said.
The close race might have turned in the final weeks when Scanlon, who raised nearly three times as much money as Cahill in the final two months, sent out a flurry of mailers, some of them with attacks on his opponent.
The campaign literature characterized Cahill as candidate who was too "sweet" to make the tough decisions required of a mayor and questioned his attendance record as a state representative and city councilor.
"We had to fight a lot of things in this campaign: hometown boy, big family," Scanlon said in his victory speech. "But I think we finally got our message across, and this is a reward for having worked hard for 16 years to make Beverly a better place."
Longtime Scanlon supporter Bruce Nardella said Scanlon's second-place finish to Cahill in the preliminary election lit a fire under the mayor and his backers.
"Frankly, I think that was the best thing that could've happened to us," Nardella said. "It got us more focused, and it got us more energized. We knew we had to work harder. There were two good candidates, but we worked hard to get Bill's record out in front of the voters over the last three weeks, and I think that made the difference."