Missing the point
The logic behind this "argument" is fallacious in a number of ways. Primarily it misrepresents how science actually works by forcing it into a binary conception of "right" and "wrong." To describe outdated or discredited theories as "wrong" misses a major subtlety in science: discarded theories aren't really wrong, they just fail to explain new evidence, and more often than not the new theory to come along is almost the same as the old one but with some extensions, caveats or alternatives. Often enough, these "new" theories are already in existence and just waiting in the wings ready for new evidence to come along and differentiate them.
For example, take geocentrism. One of the strongest arguments against heliocentrism was the apparent lack of stellar parallax (or an apparent shift in the position of the stars from season to season). Because there was no evidence, Greek astronomers assumed either that the stars were fixed in the sky (geocentrism), or were so far away parallax was not noticeable. For almost 2000 years there was no evidence for parallax, and it was not until the 1800s that parallax was proven to be correct and geocentrism soundly quashed.
Another example: the quantum theory doesn't explain gravity, but it does not invalidate the Schrödinger equation or the quantisation of energy; it merely says that the current formulation of the theory is incomplete and there are modifications to quantum theory already being formulated, ready for when the next big leap in observational evidence occurs.
That science can be "wrong" in this way is a feature, not a bug, as one of the differences between science and pseudoscience is that science builds upon itself, whereas pseudoscience rails on one claim and doesn't let up, despite evidence to the contrary. These pseudoscientists present "science" as a monolithic entity with no differentiation between different sciences and the uncertainties and overlaps associated with each field. For example, an economic study of the minimum wage that uses the scientific method cannot be replicated as easily as, say, a basic chemistry experiment that can be repeated in a lab - like finding the boiling point of a chemical. Thus, the economic study may not be "wrong," but has a lower degree of certainty attached to it than the chemistry experiment. Inability to make this distinction is often the result of the failure to think in a Bayesian fashion, in which the subtleties of errors are more accurately appreciated. Thus the "science was wrong before" argument conflates different types of errors within science, confusing incompleteness of theories with being outright wrong. This, as Isaac Asimov called it in his essay The Relativity of Wrong,[2] is a form of being wronger than wrong.
Basic logical flaws
But more than just being a complete misrepresentation of science, claiming that "science was wrong before" is flawed at the even basic logical level. Frist, this phrase can be considered a non sequitur or red herring because it usually has nothing to do with the subject at hand. For example, that phlogiston was wrong has no bearing on whether or not evolution is correct, and that neutrinos may travel faster than light has absolutely no relevance to homeopathy,[3] as that is already governed by a certain evidence base.
This is also a false dichotomy; someone using the argument is apparently suggesting that all science and rationalist thought must be perfectly correct the first time or their selected woo-du-jour must be correct. Using a reductio ad absurdum, the argument can apply to any and all forms of science and technology. (If hypotheses and theories which have been tested time and time again and been proven correct can be "wrong", what does that say about unproven, or even disproven, claims?) Therefore, there would be no way to test the validity of any claims, at all. But no one would say, "I'm not going to drive in a car! Science has been wrong before!" If "science has been wrong", and this disproves the effectiveness of earwax, doubly does it disprove the effectiveness of ear candles.
For these reasons, "science was wrong before" is an objection that is not even wrong, and tends to be used as a last-ditch escape hatch when the crank has run out of concrete objections or talking points.
Failing at even being fallacious
Oftentimes, extremely factually-challenged (or intellectually dishonest) cranks will spin an urban legend, myth, or misinterpretation of a historical event as a case where "science was wrong before." These are cases where not only is the logic flawed, but the "examples" themselves are factually incorrect:
"Science was wrong before" is often found alongside the Galileo gambit. The obvious problem here is that Galileo was persecuted by the Catholic Church, not by "science".
In many cases, old theories were not proven wrong, but only shown to be incomplete. For example, the discovery of quantum mechanics didn't prove classical or Newtonian mechanics wrong, but it did show that classical mechanics did not hold true in every case.
A common talking point among global warming deniers is the so-called prediction of "global cooling" in the 1970s. There were in fact scientists who argued for global cooling; however, a survey of the literature as a whole shows that the majority of papers published even back then argued for warming.[8][9]
Paul Ehrlich's The Population Bomb is often invoked to handwave away any concerns about overpopulation or sometimes even all environmental issues.
Anti-environmentalists in general love to abuse this gambit. Need to write a good bull**** tract on global warming? Dig up old denialist literature on any recent environmental problem (acid rain, DDT, ozone depletion, take your pick) and use it to announce that "science was wrong before." Anything by S. Fred Singer should do the trick.