It is narrated from Hazrat Adi bin Hatim Tai (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: Whoever swears an oath about something and then sees something else better than it, he should do that which is better (and offer expiation for his oath).
Hadith Referenceمسند احمد / أول مسند الكوفيين / 18257