A recurring musical theme; a leitmotif.
An idea dominating the mind and maintained despite evidence to the contrary; (loosely), an obsession.
Obsessively in mind.