But the phrase originated in Warrensburg, Missouri, in 1870, during the Burden vs. Hornsby court case. Charles Burden had a fine hunting dog, named Old Drum, that had been shot by a neighbor, Leonidas Hornsby. Somehow the case became such an intricate wrangle that it reached the Supreme Court of Missouri. There Burden was represented by Senator George Graham Vest. In the course of the final appeal, Vest spoke of the value of a dog, including these words:
The best friend a man has in this world may turn against him and become his
enemy. His son or daughter that he has reared with loving care may prove
ungrateful. Those who are nearest and dearest to us, those whom we trust with
our happiness and our good name, may become traitors to their faith. The money
that a man has, he may lose. It flies away from him, perhaps when he needs it
the most. A man’s reputation may be sacrificed in a moment of ill-considered
action. The people who are prone to fall on their knees to do us honor when
success is with us may be the first to throw the stone of malice when failure
settles its cloud upon our heads. The one absolutely unselfish friend that a man
can have in this selfish world, the one that never deserts him and the one that
never proves ungrateful or treacherous is his dog.
Rest of the speech and the story here.