IANAL, but I would think a good lawyer could get their client out of a plea deal that was agreed upon using illegally obtained evidence. Would habeas corpus apply to being wrongfully treated in a plea agreement, or does that only apply to unlawful imprisonment?