Although I can find no definitive teaching on the subject either in Holy Scripture or in the writings of the Fathers, the Book of Genesis states explicitly that God gave man dominion over all animals (Gen. 1:26). Therefore, in my humble opinion, it would not be immoral to euthanize a pet or animal if such a severe medical condition warranted it.