Some court could, yes. The rule is that if the number of "indeterminate" ballots or votes exceed the margin of victory, then the result of the contest is not valid.
"Indeterminate" could be ballots known to be for the cheating team, or ballots not meeting rules but also not known for sure to be one way or the other, etc.
There are cases of elections ruled invalid, and the US constitution provides more than one way to deal with the case when a state's return is not available or is not trusted.