I'm glad you came to the conclusion you did. The whole time, I thought you weren't going to accept that your wife was saying 'her or me'. Regardless of the situation, you can't expect a reasonable, jealous person to understand that once the drunken situation happened. She tried to deal with her jealous nature up until that point, but that was enough, as it should be.
IMO, you're making all the right decisions. I think you should choose your wife over the friend, assuming it'll be the happiest decision for all involved down the road (as in, this is the largest problem in your marriage). I also think you should tell the friend the truth. And, in the future, have ONLY open communication with her. As in, don't use text messages or other things that your wife might not know about. Keep the communication sparse (but still there), but make sure that every time it happens, your wife is informed. It'll help her to trust you again and understand that she's the only one for you.
Best of luck