ZANESVILLE, Ohio — Danny O’Connor, the Democratic nominee in a special congressional election here, has denounced both party leader Nancy Pelosi and the Republican-passed tax cut. Troy Balderson, a longtime Republican state legislator, has underwhelmed his party’s strategists and has run only slightly ahead of O’Connor in fundraising.

Ohio’s 12th Congressional District, which stretches from Columbus’s suburbs into conservative rural Ohio, is giving both parties a sense of deja vu. Four months after first-time candidate Conor Lamb won a strongly Republican district in Pennsylvania, rattling the president and his party, Republicans are working to prevent another upset by a young Democrat running as a moderate — all health care, no hot buttons.

“My opponent says he wants to raise the retirement age,” O’Connor, 31, told a gathering of 25 Democrats in one of the district’s most conservative counties. “How’s that good for the middle-class economy? Cuts to Social Security and Medicare — we know that’s how [Republicans] want to balance this budget. That’s not going to happen on my watch.”

The Aug. 7 special election in central Ohio, which was called after longtime Republican Rep. Patrick J. Tiberi resigned to lead the state’s Business Roundtable, will be the last gut check for both parties ahead of November’s midterms. That election will fill the seat until November, when the two again will face off.

Republicans, who presided over a 2011 gerrymander that appeared to turn the district safely red, concede that Democrats have put it in play. A Republican super PAC has been on the air for five weeks; both Vice President Pence and House Speaker Paul D. Ryan have flown in to help Balderson raise money and wake up voters.

“It’s going to be all about turnout in the dead of summer,” Tiberi said in an interview. “Nationally, the momentum is on the Democrats’ side. You’re going to see a lot of money coming in to help O’Connor. The Democrats did a good job with him. They recruited a blank slate.”

Since losing the Pennsylvania race in March, Republicans have argued that Democrats would struggle to re-create Lamb’s alchemy. Few challengers, they said, would have Lamb’s veteran-made-good biography. Few would be able to navigate their primaries without being forced to the left. Few of the GOP’s candidates would run as weakly as Rick Saccone, the rumpled state legislator who counted on support for President Trump to pull him across the finish line.

The Ohio race has challenged that thinking. With no dramatic errors by either candidate, Democrats have taken every lucky break. Republicans privately grumble that O’Connor beat Balderson, 56, to the general-election airwaves and built up his favorable numbers with ads about rejecting Pelosi (D-Calif.) and wanting to protect health-care coverage.

Balderson, who defeated a tea party activist to win his primary, had introduced himself to voters as a Trump supporter who would “build the darn wall” on the Mexican border. O’Connor, who runs an elected bureaucratic office in Franklin County, home to Columbus, won the endorsement of the Columbus Dispatch after his rival couldn’t say where he and Trump might disagree.

Republicans have responded, as they did in Pennsylvania, by portraying the Democrat as a liberal who’s too slippery to admit what he really thinks. In mail pieces paid for by the Ohio Republican Party, O’Connor’s face appears next to those of Hillary Clinton and Pelosi — despite his pledge not to vote for her.

One mailer says the Democrat’s campaign is “funded by Nancy Pelosi’s liberal allies,” as a way around his no-Pelosi pledge. The Congressional Leadership Fund (CLF), which went on the air in June, has portrayed Balderson as a leader on opioid policy and O’Connor as a Democratic Party puppet.

“He’s a liberal, period, end of discussion,” said Corry Bliss, CLF president. “He’s said he’s a member of ‘the resistance.’ He’s said he doesn’t support the middle-class tax cuts. He supports amnesty for illegal immigrants.” (O’Connor supports a legal status for young undocumented immigrants brought to the United States as children.)

Democrats admit that O’Connor can’t win simply by mobilizing Democrats. The 12th District, which was drawn in 2011 to reelect Tiberi, backed Trump for president by 11.3 points after backing Mitt Romney by 10.5 points. Trump ran far ahead of Romney in the district’s rural counties but ran weaker in Franklin and Delaware counties than any GOP nominee in this century.

“Bashing Trump is not going to win the election for Danny,” said Zack Space, a former Democratic congressman and current candidate for state auditor, whose old district included parts of the new 12th District. “What wins the election is if people trust him. He’s done a good job distancing himself from the powers that be.”

O’Connor’s strategy actually puts him closer to a powerful Republican who once represented the district — Gov. John Kasich. In one of his first ads, O’Connor highlighted a female supporter in Delaware County who backed both Kasich and Trump and saw in O’Connor someone else who didn’t “worry about the labels.”

Kasich, a critic of the president, has remained neutral in the race for his old seat. Balderson, who opposed Kasich’s successful effort to expand Medicaid in the state, does not mention the popular governor in his ads. Balderson’s campaign, and the independent CLF effort, both portray him as a bipartisan figure who fought drug abuse and human trafficking as a state legislator.

Yet the issue Republicans hoped would salvage their campaigns — the tax-cut package passed last year — has proved to be more of a weapon for O’Connor than a boon to Balderson.

At a Thursday-morning forum in Columbus’s suburbs, O’Connor gleefully tore into the tax-cut bill and highlighted Balderson’s support for Social Security changes that would raise the retirement age.

Balderson rattled off three anecdotes about small-business owners who told him they had raised wages after the tax cuts’ passage; O’Connor pushed back by arguing that most of the tax cuts’ benefits had gone to wealthy individuals and businesses that did not need them.

Pressed on how he could support a balanced-budget amendment to the Constitution as well as tax cuts, Balderson suggested that “it’s going to take more than just tax cuts to bring this country out of debt” — which O’Connor suggested meant the Republican would threaten the safety net.

Republicans said they were not picky about Balderson from issue to issue. Nancy Flood, 71, said after the Thursday forum that she backed Balderson largely because the president needed reinforcements.

“The Democrats need to accept that President Trump won, and they need to back him,” Flood said. “My concern is that if they got in, they’d keep Obamacare and get rid of ICE,” she said, referring to the federal immigration agency.

O’Connor, whose stump speeches make no mention of Trump, was focused on motivating “Kasich Democrats” to send a moderate to Washington. Thousands of Democratic voters in the district, he said, had voted in the 2016 Republican primary to help Kasich beat Trump.

In over 30 minutes of door-knocking Thursday in Columbus’s suburbs, O’Connor found two Republicans who said they were open to backing a Democrat because of gun policy; Balderson had an NRA “A” rating, while O’Connor wants to ban assault weapons.

At the same time, O’Connor has had little trouble organizing die-hard Democrats. For most of his final term, a local chapter of Indivisible had protested Tiberi at his office, demanding a town hall meeting on health care that never came. Dozens of those activists have signed up for O’Connor’s campaign. John Russell, a candidate who ran to O’Connor’s left in the May primary, has transitioned his campaign into a group of “70 to 75” canvassers who were going door to door for the nominee.

“We disagreed over the scale of some issues, but there’s a pretty stark choice between Danny and Troy,” Russell said.

At a house party near Zanesville, O’Connor occasionally got an earful on the way he was running his race. Jim Crannell, a retired teacher and Democratic Party organizer, said that the candidate was “too timid” on health care, too much like the Democrats who had lost in 2016.

“Go to single-payer!” said Crannell, 70, leaning on his cane. “You broke my heart when you said you want to support the Affordable Care Act. That was one of the worst programs ever!”

O’Connor agreed to disagree, saying he needed a serious cost estimate for a “Medicare for All” program, then moving to the next room of the house party.

Crannell shook his head. But O’Connor would be getting his vote.

“Trump’s a psychopath,” he said. “We have to stop him.”