I'm so sorry to hear about the loss of your dog!
Cavaliers have some bad genetics when it comes to heart disease. While there can be some treatment for heart issues, it doesn't cure the problem. It sounds like his quality of life was really suffering because of the heart disease. I'm sure he was suffering when turning blue. I do believe you made the most loving decision for him.