"That" is more immediate, specific, and personal; "it" is more abstract, generalized, and detached. When it comes to using the word "that", you can almost visualise in your mind that the person using that word is pointing to something, however when using the word "it", it becomes more general and detached to what you are referring to. Although in the example above
"If I lie to you, I'll lose your trust forever. That's/it's the last thing I want."
"I'll search for Mary. That/it was my original plan anyway."
Both have the same meaning, but "that" is more preferable due it's specificity.