Joshua 9
Without consulting or inquiring of the Lord, Joshua was deceived by the trickery of the Gibeonites and thereby granted them a treaty of safety from being conquered by the Israelites. When Joshua and the leaders of the Israelites came to a realization of the situation, they had to decide how to proceed. They then acknowledged that they had made a foolish oath by the Lord, but now had to keep it. The Gibeonites admitted that they did what they did because they feared for their lives. Joshua was now confronted with "doing what seemed good and right", so he decided to honor the oath made by the Lord.
We often find ourselves in similar situations, realizing we had made foolish mistakes and wanting to now do the right thing. This lesson from Joshua teaches us to first consult with the Lord in our decisions so that we don't find ourselves in these situations.