I agree with Redpepper that your story is not an uncommon way people discover polyamory. Many polyamory discovery stories are filled with "lessons learned."
On the positive side, I have heard of some poly stories where it did succeed despite an initial affair, but it was not easy for anyone involved. The last one I heard worked because they guy came completely clean. The wife needed about a year to deal and process it all. She set the pace, but in the end, she was able to re-trust her husband and her friend.
But I have also heard these stories turn bad. I hope it works out well for you.