The stranger, Mark Twain, utters the following at the end before he departs:
"Oh! hang Smiley and his afflicted cow!"
He states that he muttered these words "good-naturedly," which is patently ironic because the tone is obviously not good-natured. The phrase means having or showing a pleasant, kind, and friendly disposition, which is clearly not the case here. Twain's use of exclamation marks (very close to an expletive), and his statement that the "amicable Mr. wheeler" should "hang Smiley and his afflicted cow" is more of an imperative than a friendly "thank you" to him. The speaker is clearly annoyed by Mr. Wheeler's monotonous tale and does not wish to indulge him any further.
Secondly, the irony is situational. The stranger refuses to continue listening but has, for a long time, closely followed Mr. Wheeler's narration without once interrupting him. He allowed Mr. Wheeler to speak on and on and is now almost inexplicably irritated by Mr. Wheeler's enthusiasm to continue the story. It is ironic that he spent so much time listening only to suddenly refuse to continue doing so. If the story has really been as boring and annoying as he has suggested, why did he not stop Mr. Wheeler and excuse himself earlier?
It appears as if the stranger (Mark Twain) was somewhat mesmerized by Mr. Wheeler's storytelling and only realized that he was being fooled with when Mr. Wheeler was called to attend to some matter and stopped speaking. It is almost as if Twain, during that brief break, regained awareness and came to his senses. He seems to have realized, in that moment, that Mr. Wheeler has been wasting his time and that listening to him would not bring him any closer to the actual character he enquired about: the cherished boyhood companion of his friend, Mr. A. Ward, Reverend Leonidas W. Smiley.