Psalm 118 does not have an author attributed to it, but I can certainly see the verses above coming from the pen of David. Though by no means a perfect man, David was proclaimed by God to be a man after His own heart. And just as Jesus was betrayed by Judas, David was betrayed by one closest to him. Ahithophel was David's friend and trusted advisor. In a world of uncertainty, David knew he could count on Ahithophel to stand by him. However, when David's son, Absalom rose up to revolt against his father, Ahithophel deserted David and ran to Absalom's side. Whether it was greed or pride that caused this desertion, I cannot say, but in the end, Ahithophel paid for his disloyalty with his life. But not before he broke David's heart.
It's one thing for our enemy to do us wrong, but it's an entirely different story when someone we trusted betrays our confidence in them. David learned that lesson the hard way. And whether he penned the above psalm or another who had faced a similar situation did, the message is the same. No matter how good, wealthy or wise a person may seem, we should not put our confidence in them, at least not to the extent that we place their counsel above God's. People fail; God doesn't. People disappoint; God doesn't. People's loyalty can be swayed or even bought, but God's can't. We can have confidence in Him because He is the only perfect friend and counselor. He is the only one on whom we can completely depend. And unlike imperfect people, God doesn't break hearts; He mends them.