Lamb claimed victory before exuberant supporters after midnight, though many absentee ballots were still to be counted in the contest that has drawn national attention as a bellwether for the midterm elections in November when the Republican Party's House and Senate majorities are at risk.
Lamb, a Marine veteran, told his crowd that voters had directed him to "do your job" in Washington. "Mission accepted," he declared. Earlier, Saccone told his own supporters, "It's not over yet, we're going to fight all the way, all the way to the end, we'll never give up."
Regardless of the outcome - and a recount was possible - Lamb's showing in a district Trump won by 20 points in the presidential race was sure to stoke anxiety among Republicans nationwide and renewed enthusiasm among Democrats.
After midnight with all precincts reporting, unofficial results had Lamb leading Republican state Rep. Saccone by fewer than 600 votes. More than 1,000 absentee ballots were still being tabulated as the count carried into Wednesday.
In a race this close, either candidate's supporters can ask for a recount. However there are stiff requirements, including requiring three voters in the same precinct who can attest that error or fraud was committed.
The stakes in the high-profile special election were more political than practical.
The ultimate winner will face re-election in just eight months, and the congressional district as currently shaped will likely vanish next year thanks to a court-ordered redrawing of the state's district maps. Yet President Trump and his chief allies invested tremendous time and resources in keeping the seat in Republican hands, mindful the contest could be used to measure Trump's lasting appeal among white, working-class voters and Democrats' anti-Trump fervor.
The White House scrambled to rally voters behind Saccone, who cast himself as the president's "wingman," but he struggled at times to connect with the blue-collar coalition that fueled Trump's victory little more than a year ago.
Lamb, a 33-year old former federal prosecutor, asserted his independence from the Democratic Party, courted labor backing and focused on local issues. He studiously downplayed his opposition to the Republican president in the district where Trump's support has slipped by not plummeted.
"This didn't have much to do with President Trump," Lamb said Tuesday after casting his vote in suburban Pittsburgh.
The president has campaigned in the district twice and sent several tweets on Saccone's behalf. Other recent visitors include the vice president, the president's eldest son, the president's daughter and the president's chief counselor. Outside groups aligned with Republicans poured more than $10 million of dollars into the contest.
For Democrats, a win would reverberate nationwide, while even a narrow loss would be viewed as a sign of increased Democratic enthusiasm just as the midterm season begins.
Lamb's excited supporters included his middle school football and basketball coach, Joe DelSardo, who recalled him as "a leader from the beginning."
The former coach described the district as having "a lot of suit-and-tie people and people who dig in the dirt." Lamb, he said, "can talk to all of them, and that's why he can win."
Registered Republican Brett Gelb said he voted for Saccone, largely because the Republican candidate promised to support the president.
"Saccone backs a lot of President Trump's plans for the country," said Gelb, a 48-year-old fire technician who lives in Mt. Lebanon. He added, "I do think Trump is doing a good job. I think he needs backup."
Democrats must flip 24 GOP-held seats this fall to seize control of the House, and months ago few had counted on the district to be in play. The seat has been in Republican hands for the past 15 years.
It was open now only because longtime Republican congressman Tim Murphy, who espoused strong anti-abortion views, resigned last fall amid revelations of an extramarital affair in which he urged his mistress to get an abortion.
With polls showing a tight race for months, Saccone tried to persuade the GOP-leaning electorate that their choice was about "making America great again," as the president repeatedly says.
Saccone, a 60-year-old Air Force veteran turned state lawmaker and college instructor, enjoyed enthusiastic backing from the social conservatives who've anchored his state career. He's been perhaps at his most animated when emphasizing his opposition to abortion rights.
Yet Saccone struggled to raise money and stir the same passions that helped Trump on his way to the White House. The consistent fundraising deficit left him with limited resources to air the message he delivered one-on-one: His four decades of experience in the private sector, international business and now the Legislature should make voters' choice a no-brainer.
Lamb, meanwhile, excited core Democrats and aimed for independents and moderate Republicans.
"We worked really hard for it," Lamb said after voting.
National Republican groups filled airwaves and social media with depictions of the first-time candidate as little more than a lemming for Nancy Pelosi - the Democratic House leader that Republicans love to hate.
Lamb answered the criticism by saying he wouldn't support Pelosi as floor leader, much less as speaker if the Democrats should retake control of the House. He also said he opposes major new gun restrictions - though he backs expanded background checks - and declared himself personally opposed to abortion, despite his support for its legality.
Besides bruising the president, a Lamb defeat also could shake Republican self-assurance that their new tax law can shield them from other political woes.
Lamb embraced Democratic orthodoxy on the new GOP tax law, hammering it as a giveaway to corporations at the future expense of Social Security, Medicare and the nation's fiscal security. And he embraces unions, highlighting Saccone's anti-labor record at the statehouse, which was a notable deviation from the retiring Murphy's status as a union-friendly Republican.
The AFL-CIO counts 87,000 voters from union households - around a fifth of the electorate.
Peoples reported from New York.
Follow Barrow and Levy on Twitter at https://twitter.com/BillBarowAP and https://twitter.com/timelywriter .
Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.