There is a rule that Ka'asher Zamam vilo Ka'asher Asa: the second set of witnesses have to appear in court "before the punishment" in order that the first witnesses get the punishment Ka'asher Zamam. And it has to be after the court set out his punishment.
Example: Two witnesses come to court and say that Rueven killed Shimon, so the court checks out whether they are true. Let's say they look like valid witnesses and the court says Rueven is subject to death by sword. Then the second pair of witnesses who make the first aydim zomim have to come between now and the actual chopping off of the head of Rueven: two witnesses come to court and say "You were with us etc" making the first set aydim zomim.
So my question is: if this happens but instead of death the punishment is that the defendant becomes a challal (the first witnesses instead said that Rueven (who is a cohen) is a ben grusha, son of a divorcee) so there is no time between when court says he is a challal and actually becoming a challal. What then?