Bhagavad Gita 18.37
Chapter 18: Freedom through renunciation
यत्तदग्रे विषमिव परिणामेऽमृतोपमम् ।
तत्सुखं सात्त्विकं प्रोक्तमात्मबुद्धिप्रसादजम् ॥ ३७ ॥
Which at first is as venom but in the end is as nectar; that pleasure is said to be pure, born of the blissful knowledge of the Self.
Sanskrit text and English translation: Annie Besant, The Bhagavad-Gita, 4th edition (1922) — public domain, via Wikisource. Chapter summaries: SamayaVeda.