To my understanding, spoiled food is not supposed to be consumed even after cooking it, since the heat may eradicate germs, but their toxines may be heat-resistant and thus still active. However, there are some purification tablets which are marketed as making spoiled water potable, apparently containing chlorine or iodine usually. Such tablets seem to be recommended also for water purification by the WHO. In the description of such tablets, their effect on toxines is never mentioned, and I wonder why toxines surviving the eradication of germs seem to be no problem here. Do water borne germs usually not synthesize toxines, or to a much lesser extent than food borne pathogens? Or do such tablets somehow inactivate their toxines?
To some extent you can eat heated spoiled food (the point of cooking really). I recall a concentration camp in France where inmates received sporadically tuberculosis infected dead cows, which they ate following a 24h boiling in water. Water is quite often contaminated but more rarely infected in the sense of supporting active multiplication of pathogens (with notable exceptions in cases of flooding with cholera epidemics for instance). In addition on most of the chlorine tablets it is specified it should only be used on clear water (filtered or not, but no turbid water).