In verse 9, David is more than likely of the man called Ahitophel the Gilonite who was a counselor and turned against David when his son Absalom tried to take over the throne. This is prophetically true of Judas as we read in John 13:18. The ironic thing although hundreds of years apart both of them end up committing suicide. The very words were quoted by Jesus. This verse tells me about when this Psalm was written. However there could have been other men that would have done this too. Like many of the other psalms, David ends this in the spirit of praise. Never give up and give in.