Intuitively, the reaction to disturbing thoughts and erotic fantasies is to chastise oneself, to cause oneself psychological pain. The Baal Shem Tov rejected this path. Rather than wrestling with the dirt head on, he provided a path that soars high above.

הלימוד יהיה בכח ובשמחה גדולה, וזה ממעט מחשבות זרות

Study with energy and great joy.

That will reduce disturbing thoughts.

—Tzava’at Harivash 51