I am interested in old-timey beer, myself, although I've done only a little reasearch on the matter. Just by that little bit, though, I've had a few thoughts on the matter.
Ancient Stuff ---
There is no doubt that the truly ancient beer (i.e., the stuff that started out in the Near and Middle East and during the B.C. times) was "truly awful" by today's standards. However, that is not necessarily because it was spoiled. Rather, it was a very different beverage.
Just like today, beer begins with the grains. They did use, pretty much the same grains (i.e., barley, wheat, and oats, and I understand they also used millet fairly often). However, malting was a different process, and most of the grains were nowhere near "fully" modified. Of course, that's after they actually developed malting. I'm pretty sure everyone is fairly familiar with the lack of "pale" malt, as well, although that may not have been the case with the very ancients, since they may not have even kilned all their malt in the first place. In any event, efficiencies likely were very poor, which was no big deal, since beer was consumed largely for nutrition. As a result, folks went for the thick, starchy stuff.
Beer was a much weaker beverage, as well. Of course, there is absolutely no way to know what the alcohol content was, but many believe the common beers probably clocked in somewhere in the 3% range, with a great deal of variance that depended on the brewer, the area, and the occasion for the beer. It also seems that much beer probably was consumed with even less alcohol, as much of it was consumed before it was fully attenuated. Again, beer was mostly for nutrition. Yeast provided that nutrition. Fermenting beer also may have been preferable to fully fermented, as the carbonation from the fermentation would provide a pleasing mouthfeel and the CO2 in the fermenting vessel (likely an open vessel) would prevent oxidation.
Another large change, as some have pointed out, was that the beer had no hops in it. There are no hops around those parts, so they used other spices to preserve the beer. You might have seen beers spiced with cardamom, ginger, anise, black pepper, fenugreek, or any number of other spices in order to preserve the beer and balance the sweetness.
So, was it "spoiled" or "sour" or "infected," as we think of beer, today? Sure, it was. However, it very likely was not at all wretched. First, again, much of it was consumed very young (if even fully attenuated), so the yeast barely had a chance to take hold -- much less the bacteria that tend to act more slowly in beer. Not only that, but the lower efficiencies did not provide as fertile an environment for the bugs.
Further, as many above have pointed out, beer was not necessarily fermented wildly. Much in the same way the ancients carried out some fairly sophisticated selection among crops without understanding molecular genetics, they also carried out some fairly sophisticated yeast selection without understanding microbiology. Folks used the "magic" stick, or they used the same fermenting pot that made a good batch. They may have innoculated wort with krausen from a "good" brewer or with some of the unfiltered beer from a good batch. They weren't just setting the wort out somewhere and praying for the best. They were working at it.
Just to wrap up the story, as beer moved into Europe, much of the same practices were adopted. However, the Europeans used what they had (i.e., more hops and barley, but less other spices and millet; cooler climates for different fermentation). As European brewing developed, the more eastern beers vanished as Islam spread through the region.
TL