When David Levdansky went to bed early Wednesday morning, he was up by 64 votes against his Republican opponent, Rick Saccone, for the 39th House District seat and thought he had won the race.
When he woke up five hours later, Allegheny County had changed its numbers and Mr. Levdansky was losing by 36.
"All I know is these are unofficial results," he said Wednesday afternoon.
In the latest unofficial totals, Mr. Saccone has 14,274 votes to 14,238 for Mr. Levdansky, or a lead of 50.01 to 49.94 percent.
The totals will have to be sorted out over coming days as Allegheny and Washington county elections offices count absentee and provisional ballots.
Mr. Saccone, who is in his first term in the House, is a retired U.S. Air Force officer, author and professor at Saint Vincent College. He beat Mr. Levdansky, a Democrat from Forward who held the office for 26 years before that, in the 2010 election by 151 votes.
In that contest, a count of absentee and provisional ballots after election night widened Mr. Saccone's margin and Mr. Levdansky announced three weeks later that he would not seek a recount.
Mr. Saccone could not be reached for comment.
Larry Spahr, the director of elections in Washington County, said there are 275 absentee ballots that were cast by voters in the 39th district in his county.
He expects those optical scan ballots will be counted Tuesday or Wednesday. Both candidates will be invited to watch.
In the past, Mr. Spahr said, absentee ballots have split evenly.
"Usually, they pretty much distribute 50-50," he said.
The Allegheny County elections office was closed Wednesday.
The numbers may not be certified for a week or more and don't have to be filed with the Department of State until Nov. 26, spokesman Ron Ruman said, but they typically are filed sooner.
Only statewide races can trigger automatic recanvassing of votes.
In a state House race they are done on a precinct-by-precinct basis, and three voters from each precinct targeted by a campaign would have to petition Common Pleas Court for a recount. The deadline for petitioning the court comes five days after a county officially certifies its votes.
One other state House race also remains unresolved. The contest between state Rep. Tom Quigley, R-Montgomery, and Democrat Mark Painter also is awaiting final tallies.
The pending results mean that House Republicans will return in January with a majority of at least 110 out of 203 legislators.
Two House seats will be vacant in January because two Democratic representatives won races for higher office, likely leading to special elections early next year.
Matt Smith of Mt. Lebanon won a race for state senator, and Eugene DePasquale of York was elected state auditor general.