Vice Mayor Allison Silberberg fills out her ballot at the Agudas Achim Congregation in Alexandria, Va., on Tuesday. (Jabin Botsford/The Washington Post)

After a driver hit a young trick-or-treater on Russell Road in Alexandria nearly two years ago, residents complained to City Hall about speeding vehicles that had caused scores of accidents on the street. The only official who responded, they say, was Vice Mayor Allison Silberberg (D).

She worked to get speed bumps installed, and they have slowed traffic considerably. She also contacted the injured 7-year-old and his family to check on his recovery.

Russell Road resident Christopher Tyson, who had never voted for a Democrat, was so impressed that he created yard signs that advertised “Republicans for Allison” when Silberberg ran for mayor this spring.

He also cast his ballot for Silberberg in Tuesday’s open Democratic primary, helping catapult her ahead of Mayor William D. Euille and a third candidate, banker and former mayor Kerry Donley.

Four-term Alexandria Mayor William Euille lost the Democratic primary Tuesday to Vice Mayor Allison Silberberg. Silberberg was the only City Council member to vote against Alexandria’s waterfront redevelopment plan which earned her support from historic preservationists. (WUSA9)

It was a stunning upset by a candidate who is known as warm and personable but had raised far less money than Euille, and her three years on the City Council have yielded few concrete achievements beyond questioning big development projects and listening to the little guy.

“Allison earned our trust as an elected official — and now friend — who truly listens and acts to solve real problems for the good of our community,” Tyson said. “A lot of local politics aren’t partisan. Public safety, good schools . . . there’s no Democrat or Republican on those issues.”

Silberberg beat Euille by 321 votes out of 13,438 cast, a margin of just over 2 percent. She has no declared opposition in November’s general election, although Euille says he is being urged to launch — and will consider — a write-in campaign.

Voters said they were looking for fresh leadership in a city that is seeing a wave of big projects and has been led by two men — Euille, 64, and Donley, 59, his predecessor — for the past 19 years.

Silberberg, 52, drew her strongest support in Old Town, where her votes against a major waterfront makeover resonated. Throughout the city, she was supported by residents who have questioned the pace of development and wondered whether city leaders were too beholden to developers.

“She was not the strongest of candidates. But she stood up on the issues that people care about,” said Andrew Macdonald, a Democrat who opposed the waterfront plan and challenged Euille as an independent in 2012, losing badly.

Silberberg’s comments on the campaign trail, as on the council, tended to wander. She tells stories and explores tangents, reflecting her career as a writer, rather than answering questions definitively.

On the council, Silberberg often struggles to find colleagues to second her motions and has frequently cast the lone dissenting vote on motions that passed. She frustrated other board members by submitting last-minute budget proposals, prompting the council to tighten its rules for spending requests.

In an interview Wednesday, Silberberg said she is in favor of “thoughtful, appropriate development” that fits with the surrounding area. She said she will always value citizen input: “These are folks who have lived in the community for decades, sometimes.”

Euille said a late surge of Old Town voters propelled Silberberg to victory in the race, which had an overall turnout of 16.25 percent. The precincts where Euille did best — the Cora Kelly Recreation Center, the Charles Houston Recreation Center, Samuel Tucker Elementary School and the Nova Arts Center — had many fewer voters than those where Silberberg triumphed.

“We knew turnout was going to be low,” Euille said. “Five hundred to 1,000 extra votes could have swung it the other way.”

The loss was a painful surprise for the Alexandria native, who returned home after college to work in construction. He joined the School Board in the mid-1970s, followed by the City Council in 1994. He became mayor in 2003.

An affable presence who seems to have met everyone in Alexandria at least once, Euille likes to tell people that he eats only one meal a week at home, dining at the city’s many restaurants most of the rest of the time. On Tuesday, he toured polling places, as he has done for each election. Shaking hands with voters, he said, he thought “it looked very good for me.”

He arrived at the Democratic Party’s celebration at Red Rocks in Old Town after the polls closed and worked the room. But as the results seesawed between him and Silberberg, he became increasingly withdrawn, frowning at the white board bearing the vote totals and huddling with aides.

Trailing after all precincts had reported, Euille rested his hopes on the 1,080 absentee ballots. He went for a walk down King Street. When he returned, Silberberg’s lead had grown by 120 votes.

“People at my event last night and even now are sending me text messages saying ‘Look at some other options,’ ” Euille said Wednesday.

Glen Kraus of Alexandria created an “@Writein_Euille” account on Twitter and said he wants to encourage Euille to launch such a campaign — an idea that Clarence Tong, chairman of the Alexandria Democratic Committee, said he would oppose.

“The people have spoken,” said Tong, who on Tuesday lost a five-way race for the party’s nomination for Virginia’s 45th House District seat. “Allison Silberberg is our candidate. As far as I’m concerned, we have our ticket set for the fall.”

Euille, for his part, pledged to focus on his City Hall responsibilities, which on Wednesday included welcoming the tall ship Hermione into port, chairing a Metropolitan Washington Council of Governments board meeting and running a City Council legislative meeting.

“I’m still mayor until December 31,” Euille said. “I have a job to do, and I’ll do it.”

Elizabeth Koh contributed to this report.