Yes it was a horrible mistake, and yes you should learn from it. You will though, not be able to throw it away, you have to carry this the rest of your life just like your wife carries the violating hurt you and OW created.
Your wife is scarred for the rest of her life. You don't have a right to throw that hurt away.
It was a mistake I, and yes it does work exactly the way the books are telling you.