Huck learns a number lessons at the Phelps farm, two of which connect to the larger themes of the novel. Huck learns that doing unnecessary harm to others is wrong and he learns that if he strives to follow his own moral thinking he will not hurt anyone. Each of these lessons relates to the other, clearly.
At the Phelps farm, Huck comes to regret the pain he and Tom cause to Mrs. Phelps. With the snakes and stolen sheets, Mrs. Phelps is essentially terrorized by the two boys set on helping Jim to escape. All these pains are, however, completely unnecessary.
Huck learned from Jim earlier in the novel that playing jokes on people can hurt their feelings. In recognizing the humanity of others, one must strive to refrain from inflicting harm (especially for one's own amusement).
Additionally, Huck is willing to "go to hell" to save Jim, but is exculpated in the end because Jim is already free. Mrs. Watson has signed his manumission papers and Jim is no longer a slave. This means that Huck is not a thief. He was prepared to be condemned for his actions because he felt that freeing Jim was the right thing to do.
In this lesson, Huck finds that following his conscience can lead to positive outcomes without moral complications. He had been worried about this notion.