There’s two when that happens.

One where the season 2 doctor replaced Crusher (because apparently the producers didn’t like Gates McFadden even though the cast and viewers did) performed the operation.

And another where Q sent Picard back in time (kind of) to undo the incident that lead to his heart getting stabbed.

The latter episode hasn’t aged well because of one unnecessary romantic/sex scene. Which is a pity because it’s an otherwise fantastic episode.

But then the TOS has its fair share of cringeworthy moments for modern audiences that made total sense in the era it was aired.