I don’t think the specific incidents are the problem. I think you may be playing with a way to get out of your distressed marriage without taking full responsibility for it. Apparently, either telling your wife of her friend’s pass or confessing to flirty behavior while drunk will tip the balance and your wife will end it.
You said your relationship has been “on the rocks” for a couple of years. Why aren’t you and your wife doing something about it? I strongly urge the two of you to make an appointment with a couples counselor and work on the core problems in your relationship.
Yes, it will be difficult. Although most couples benefit from counseling, there are no guarantees. But even if you do not stay married, you and your wife will have a better understanding of what went wrong so you can separate honorably. Either way, you’ll both be better able to move on with your lives.
I wish you well.