What is the meaning of "me'Oyvai Techakemeni Mitzvosecha"?
Rashi: They made me wiser than Do'eg and Achitofel. Their teachings were not accepted to be the Halachah.
Radak citing his father: I became wise from my enemies; this teaches to me Your Mitzvos, when I see that they cannot remove Your Torah from my mouth. I become wise, for this is Your desire, and You created me for this.
Malbim: Your Mitzvos put in my heart Chachmah how to be saved from my enemies.
Why does it say "l'Olam Hi Li"?
Rashi: I have the secret of the Torah, for "mi'Kol Melamedai Hiskalti" - a little from this one and a little from this one.
Radak: Your Torah is a Bris Melach (it lasts forever).
Malbim: Your Torah always stands to counsel me. The Nimshal (what the parable teaches about) is that it teaches to me how to be wise against enemies of my Nefesh - desire and the Yetzer, which are man's true enemies. The Mitzvah also stands for me; via it, I will remain forever. It will accompany me in my toil in the world to come; all other matters pass and cease.