A former prosecution is not an affirmative defense within the meaning of §§ 5-1-112 — 5-1-114 under any of the following circumstances:
(1) The former prosecution was before a court that lacked jurisdiction over the defendant or the offense;
(2) The former prosecution was procured by the defendant without the knowledge of the appropriate prosecuting official or aggrieved party and with the purpose of avoiding the sentence that might otherwise be imposed; or
(3) The former prosecution resulted in a judgment of conviction that was held invalid in a subsequent proceeding on a writ of habeas corpus, coram nobis, or similar process.