Good and bad thoughts are like guests. If we entertain and treat guests with respect and show hospitality they will feel welcome and will incline to visit again. If they were to be made unwelcome or shown disrespect, they would not return. No self respecting person would return after being shown disrespect.
So it is with thoughts which enter our hearts. If it is a good thought i.e. one feels inclined to perform salaat or give in charity, one should act on these good thoughts. If one was to ignore them, they may not reoccur. When beseeched by bad thoughts i.e. the whispers of Shaytaan or inclining toward sins, one should ignore them. In this case they will occur again and again as they are similar to guests who have no self respect, but eventually they will disappear.
(From the teachings of Shaykh Muhammad Saleem Dhorat)
This cannot be undone and I am sure it will be greatly appreciated.