rajiv, what are your options? do you want to live with a machine that shuts down at unexpected moments? maybe, but i guess not;
next option: putting your imac in a closet and forget about it, no you don't want that either;
so you want to put some/more effort to solve the problem; have you spent enough time on the internet browsing hours for threads that might give you a clue and something new to try out (like reducing the amount of ram, bringing down the heat etc.);
if you have been through all this i would bring it to an apple repair centre asking them for a quotation of the costs to fix the problem;
when you are ready to pay this money i would demand that they fix the problem for this money and if it comes back from the repair centre and it is not fixed they should give it another try, on their expenses, as long as is needed to really fix the problem
replacing imac with a new one: yes, i am sure i have read this has happened but, of course, it also depends of the age of the machine, an imac that is not even one year old is more easily switched for a new one that a machine that is already 3 years old