You do that by getting a new jury, letting it decide the perp's fate after a new penalty trial, and by punishing the lawyer separately. I repeat--a criminal trial should be about the facts of the case.
Any illegally obtained evidence or prosecutorial misconduct happens AFTER the crime. If the accused did the crime and the facts prove it, then he needs to be found guilty. Any other outcome is unjust.
I think the prohibition against double jeopardy applies in death penalty sentencing trials.