The prime minister initially stood by Hancock after CCTV footage emerged of him kissing Gina Coladangelo in his office but the minister was forced to resign the following day after Tory MPs made clear his position had become untenable.
Labour’s Kim Leadbeater won in Batley and Spen, the constituency previously held by her murdered sister Jo Cox, by just 323 votes after a bitter and divisive campaign that many had predicted the party would lose.
Conservative Party chair Amanda Milling said Hancock’s conduct was an issue in the final days of the by-election campaign.
“It was something that came up on the doorstep, I have to be honest about that. They (voters) had some issues over the weekend in terms of what happened,” she told Sky News.
She added: “I know the public will be incredibly frustrated because at the end of the day we have all made a huge number of sacrifices. But Matt did the right thing by resigning. The matter is now closed.”
One local Tory source also admitted that the Hancock affair did not help the party’s chances.
But Labour leader Keir Starmer said: “I don’t think that it played a huge part.
“What I’ve been struck by walking round the streets and being in Batley and Spen with Kim is just how positive she is, and how many people who would normally vote for other parties know her and respect her for the work she has done through the Jo Cox foundation. She is of the community and for the community.”
Labour sources told HuffPost UK there was evidence that Tory voters had switched to their party in the by-election.
One campaigner said George Galloway’s supporters’ divisive intimidation of Leadbeater - captured on camera this week - was a turning point in the campaign and “made Tories switch to us in the villages outside Batley”.
Another source said that was only part of the story in an “against all the odds” victory.
“A lot of Tories voted Kim because of her local credentials or her local record.
“Plus we were talking about the things they were talking about.
“It’s a broad range of successes on our part.
“We also ran an excellent campaign, particularly the ground game - it was very much the Labour Party at its best.”
YouGov’s Patrick English told HuffPost UK that Hancock was likely a factor in the election as data shows that the vast majority of people were aware of the story.
But he said both Labour and the Tories could be right “in so far as it’s part of a wider story of government approval drifting back out over recent weeks”.
“People are less happy with the job Boris Johnson and his government have been doing than they were a few months ago.
“The Hancock revelations are like one card in that pack.”
This article originally appeared on HuffPost UK and has been updated.