WASHINGTON — With visions of a fall tidal wave spinning in their heads, Democrats spent Wednesday celebrating a win in a Pittsburgh-area congressional district that Donald Trump had carried by 20 points.

The president put his prestige on the line in the race. The loss sent shudders through the ranks of Republicans already anxious about losing control of Congress. But the lessons are mixed for Texas, where Democrats are targeting GOP incumbents in three districts where Trump lost in the 2016 presidential race.

The demographics, candidates and economic conditions are vastly different, even if the Pennsylvania race's impact on morale was profound.

"It's game on," said Colin Allred, a former prosecutor and NFL player who hopes to oust Dallas Rep. Pete Sessions, though first he'll have to win a primary runoff. "It's heartening for us because it shows that even in areas that have been represented by a Republican for a long time that if you take your argument to the voters and talk about local issues and kitchen table issues that any precinct, any district is flippable."

Democrat Conor Lamb beat Republican Rick Saccone in the special House race in western Pennsylvania by fewer than 700 votes, an upset as stunning as the one in Alabama, where Democrats snatched the Senate seat previously held by Attorney General Jeff Sessions.

Sen. John Cornyn of Texas, the deputy GOP leader in the Senate, called it "a wake-up call" and a reminder against complacency in the fall. Rep. Charlie Dent, a moderate Republican from Pennsylvania, called it a "political earthquake" and sign of a "very major headwind" for his party.

"My guess is every Democratic candidate woke up this morning thinking they can shock the world, too," said Matt Mackowiak, a veteran GOP strategist who has run congressional campaigns in Texas. "Democratic enthusiasm is high, and the suburbs are in revolt against Trump and the Republicans. ... There's no good news coming out of Pennsylvania for Republicans."

The comparisons are there. They're just not precise.

The Texas three

Sessions is one of three "Clinton Republicans" in Texas — GOP House members elected from districts that supported Hillary Clinton over Trump in 2016.

Sessions collected 71 percent of the vote in a district where Clinton edged out Trump by 1.9 percentage points.

She carried Rep. John Culberson's district in Houston by 1.4 points even as the congressman coasted to re-election 56 to 44.

In West Texas, two-term Rep. Will Hurd survived by 3,000 votes out of 229,000 — a margin of 1.3 points — in a district that Clinton won by 3.4 points. He's widely viewed as one of the nation's most endangered incumbents.

But even for Hurd, the differences from Pennsylvania are important.

Democrats in all three districts have to slog it out through a May 22 primary runoff, giving the incumbents a head start that Saccone lacked. Lamb had no Democratic rival to sap his resources and pull him to the left.

"He could claim to be everything people wanted him to be," said retiring Rep. Joe Barton, R-Ennis. "So he was pro-gun. How many Democrats do we have that are pro gun? A few but not a lot. He claimed to be pro-life. They are almost nonexistent. ... He ran really as an independent on the Democrat label."

Barton said he wasn't worried about Sessions, a "street fighter" who led the House GOP's campaign arm, or Hurd, who has won two bruising campaigns already. But Culberson "hasn't had a tough campaign in a long time," he said. "Culberson is going to have a problem."

Unions a nonfactor in Texas

Democrats embraced Lamb as a particularly good fit for a conservative district; Cornyn called him an "outstanding candidate." The loser, by contrast, had antagonized blue-collar voters who make up a major chunk of that electorate — Trump voters who flocked to the president's populism but shunned Saccone's union-bashing.

House Speaker Paul Ryan dismissed Pennsylvania as a fluke because Democrats were able to run "a pro-life, pro-gun, anti-Nancy Pelosi conservative." In most districts, he argued, competitive Democratic primaries will drag Democratic contenders to the left. "Both of these candidates ran as conservatives. I just don't think you're going to see that across the country."

Indeed, in Culberson's upscale district, which has far more country clubbers than pipefitters, the Democrats who made the runoff last week — Lizzie Pannill Fletcher and Laura Moser — have jockeyed to outdo each other as Trump critics.

Culberson, in a brief interview at the Capitol, insisted that he saw no reason for nervousness after Pennsylvania.

He chalked up Saccone's loss to his advocacy of "right-to-work" laws that rankled union workers. "As a Republican in Pennsylvania, you cannot get elected unless you have strong labor union support," he said. In his own district, he said, "It's not relevant."

Trump factor cuts both ways

Did Trump help or hurt in Pennsylvania? Maybe both.

"I think the president helped close this race," Ryan asserted. "The public polling wasn't looking so good, and the president came in and helped close this race" to within a few hundred votes.

The White House also insisted that Trump's personal involvement kept the race closer than it would have been.

"The president's engagement in the race turned what was a deficit for the Republican candidate to what is essentially a tie," said principal deputy press secretary Raj Shah. "Also, the Democrat in the race really embraced the president's policies and his vision, whereas he didn't really embrace Nancy Pelosi, the Democratic leader."

Lamb himself did not frame the race as a referendum on Trump. Unlike many of the Democrats seeking to topple Texas incumbents, he wasn't urging voters to "send a message."

"I never really asked anyone who they voted for in November 2016. I thought that was a little impolite and kind of beside the point," he said Wednesday on MSNBC, emphasizing a willingness to work with Trump. "The president is still very popular in this district, and my guess is he did energize some voters."

For Allred, the Trump factor is real.

"He's hanging over all of this," said the Texas Democratic candidate. "But the focus still has to be on Pete Sessions and how he's disconnected from this district. That problem existed before Trump came along."

As for the standard GOP line of attack, seeking to tar Democrats with Pelosi, their speaker-in-waiting, he demurred when asked if he would support her for speaker.

"I'm not thinking about that right now," he said. "I've never had a single person in the district ask what I think about Nancy Pelosi."

GOP tax plan lacked traction

Heading into midterm election season, Republicans touted the tax overhaul enacted late last year as a top selling point — a signature achievement that would resonate with voters because they'd feel flush as they cast ballots.

They used the issue in Pennsylvania, for a while.

In the final weeks, they all but shelved it as a talking point, turning to immigration and other emotional hot buttons they hoped would generate more excitement for Saccone.

Democrats insist that means Pennsylvania voters effectively repudiated the GOP tax bill, which, as Democratic national chairman Tom Perez put it, "gives massive giveaways to corporations and their wealthy shareholders at the expense of American workers."

"Last night's stunning upset was just the latest rebuke to the Trump-Republican agenda," Perez wrote in an open memo.

The referendum argument is flawed. But the fact that Republicans cut the tax measure from their pitch strongly implies it wasn't working, at least in this district.

Washington correspondents Katie Leslie and Nicole Cobler contributed to this report.