It's a few lines later in the gemara you quoted from Kiddushin 40a:
ואלא הא דכתיב למען תפש את [בית] ישראל בלבם ... עולא אמר כדרב הונא דאמר רב הונא כיון שעבר אדם עבירה ושנה בה הותרה לו הותרה לו סלקא דעתך אלא נעשית לו כהיתר
But with regard to that which is written: “So I may take the house of Israel in their own heart” (Ezekiel 14:5), which indicates that one can be punished for thoughts alone, to what is this verse referring? ... Ulla said: This should be explained in accordance with a statement of Rav Huna, as Rav Huna says: When a person transgresses and repeats his transgression, it is permitted to him. The Gemara questions this statement: Can it enter your mind that the transgression is permitted to him because he has sinned twice? Rather, it becomes as if it were permitted to him, as he becomes accustomed to this behavior and no longer senses that it is a sin.
Rashi explains that Ulla is telling us that after one commits a sin twice, he is no longer protected by the principle of מחשבה רעה אין הקדוש ברוך הוא מצרפה למעשה, because he clearly has no compunctions about committing that sin.