Updated Friday, Nov. 8, 6:00 p.m.

Chesa Boudin, a deputy public defender promising an emphasis on reform over incarceration, has taken a small lead over interim District Attorney Suzy Loftus in the race to be San Francisco's next district attorney.

The latest results from the San Francisco Department of Elections gave Boudin a lead of just 156 votes, erasing a margin of 879 votes by which Loftus led on Thursday.

Under the city's ranked-choice voting system, the second- and third-place votes from the lower-place finishers — Alameda County Deputy District Attorney Nancy Tung and Deputy Attorney General Leif Dautch — are redistributed to the top two candidates.

The department still has approximately 15,500 ballot left to process. Of those, 13,500 are provisional ballots received from polling places, 500 are conditional ballots from voters who registered on election day and another 785 are vote-by-mail ballots that arrived in the mail Friday and were postmarked by Tuesday.

The race is too close to call, but if Boudin were to ultimately prevail, it would be a stunning rebuke to the city establishment that endorsed Loftus, including Mayor London Breed, U.S. Senators Dianne Feinstein and Kamala Harris and Gov. Gavin Newsom.

In the city's District 5 supervisorial race, challenger Dean Preston remains ahead of incumbent Supervisor Vallie Brown by a scant 35 votes. Brown was appointed to the seat by Mayor Breed, who easily won reelection Tuesday, but can't afford to lose Brown's vote at the Board of Supervisors, where the more centrist mayor has struggled to get a six-vote majority from that left-leaning body.

The race between Loftus, a former prosecutor and police commissioner who most recently worked as legal counsel to San Francisco County Sheriff Vicki Hennessy, and Boudin, a progressive, attracted national attention.

The San Francisco Police Officers Association (POA) on Wednesday sent a sharply worded letter to Supervisor Sandra Lee Fewer, who led chants of "Fuck the POA" at the election night party for Boudin. Supervisors Hillary Ronen and Matt Haney, along with other members of the city's progressive community watched and showed no sign of disapproval at the chants. Boudin was not present at the time.

The POA spent $650,000 on campaign ads attacking Boudin and has a long history of animosity toward the city's liberal leadership.