Unofficial returns on Wednesday gave the union-backed challenger, JoAnne Kloppenburg, a narrow 204 vote statewide lead over Republican David Prosser.

But late Thursday, the county clerk in Waukesha, a Republican stronghold, said that votes not included in earlier totals had resulted in a net gain of 7,582 votes for Prosser.

News of the uncounted votes came as officials throughout Wisconsin were conducting county canvasses, a final review of voting records that allows the state to certify this week’s bitterly contested elections.

The contest was widely seen as a referendum on Republican Governor Scott Walkerand the controversial curbs on collective bargaining that he and his allies passed in the legislature.

Because Prosser, a former member of the state assembly, is a Republican who expressed support for Walker last fall, opponents characterized him as a proxy for the governor and his anti-union policies, which triggered massive protests and 16 recall campaigns targeting lawmakers who supported and opposed the measure.

She said at a news conference that she had failed to properly save a spreadsheet showing one town’s voting results.

“I’m thankful that this error was caught early in the process and during the canvass,” Nickolaus said. “The purpose of the canvass is to catch these kinds of errors.”

Even before the Waukesha clerk announced her discovery, any certification was unlikely to bring closure in the passionately fought contest, where the razor-thin margin Kloppenburg had used to claim victory was considered certain to lead to a recount.

If it happens it will be the first statewide recount in Wisconsin in more than 20 years, and could begin next week.

To help officials prepare, the state’s Government Accountability Board sent out a memo stressing that local officials needed to “maintain all memory device and programing for the April 5, 2011 Spring Election in its original form.”

“We are in unprecedented times in many respects,” the memo read, “but particularly with regard to a potential statewide recount, which has not occurred since 1989 … A thorough completion of the County Board of Canvass at this time may reconcile inconsistencies and issues that will likely save you time and effort in the pending recount process.”

The apparent clerical error in Waukesha is sure to subject Nickolaus and her office to public scrutiny — for the second time in less than a year.

Last fall, the Milwaukee Journal Sentinel newspaper reported the Waukesha County Board had ordered an audit of Nickolaus’s office, citing concerns about the integrity of the equipment she used he backup system.

The newspaper said the move came after Nickolaus removed the election results collection and tallying system from the county computer network last spring and installed it on standalone personal computers in her office.

The newspaper quoted an official saying Nickolaus had been “uncooperative with attempts to have information technologists review the system and confirm the backups.”

(Reporting by Jeff Mayers and James B. Kelleher; editing by Tim Gaynor and Ellen Wulfhorst)