Mr. Lamb’s performance in a southwestern Pennsylvania House race rattled Republicans and showed Democrats how to win back Trump voters.