MN 19: Dvedhāvitakka (Two Kinds of Thought)
Recounting his own experiences developing meditation, the Buddha explains how to understand harmful and harmless thoughts, and how to go beyond thought altogether.