Yes. It has happened.
This is rare, but it happens.
One of the most recent examples involves sales tax jurisdiction.
In Quill Corp. v. North Dakota, 504 U.S. 298 (1992), the U.S. Supreme Court changed prior law to prohibit sales taxation imposed on sellers of goods who have no offices for the conduct of business in the taxing state who deliver their goods via common carriers (e.g. U.S. mail, UPS, Federal Express, etc.).
Quill Corp. hardened the rule of the case National Bellas Hess v. Department of Revenue of Illinois, 386 U.S. 753 (1967), in which the Supreme Court ruled that a mail order reseller was not required to collect sales tax unless it had some physical contact with the state. The Court in National Bellas Hess recounted some key cases in place before it was decided:
In applying these principles the Court has upheld the power of a State
to impose liability upon an out-of-state seller to collect a local use
tax in a variety of circumstances. Where the sales were arranged by
local agents in the taxing State, we have upheld such power. Felt &
Tarrant Mfg. Co. v. Gallagher, 306 U.S. 62 , 59 S.Ct. 376; General
Trading Co. v. State Tax Comm'n, 322 U.S. 335 , 64 S.Ct. 1028. We have
reached the same result where the mail order seller maintained local
retail stores. Nelson v. Sears, Roebuck & Co., 312 U.S. 359 , 61 S.Ct.
58; Nelson v. Montgomery Ward & Co., 312 U.S. 373 , 61 S.Ct. 593.10 In
those situations the out-of-state seller was plainly accorded the
protection and services of the taxing State. The case in this Court
which represents the furthest constitutional reach to date of a
State's power to deputize an out-of-state retailer as its collection
agent for a use tax is Scripto, Inc. v. Carson, 362 U.S. 207 , 80
S.Ct. 619, 4 L.Ed.2d 660. There we held that Florida could
constitutionally impose upon a Georgia seller the duty of collecting a
state use tax upon the sale of goods shipped to customers in Florida.
In that case the seller had '10 wholesalers, jobbers, or 'salesmen'
conducting continuous local solicitation in Florida and forwarding the
resulting orders [386 U.S. 753, 758] from that State to Atlanta for
shipment of the ordered goods.' 362 U.S., at 211 , 80 S.Ct., at 621.
It looked very likely prior to National Bellas Hess, that intentionally shipping goods to and advertising in a state would have subjected it to sales tax liability (something called "purposeful availment"), by analogy to other personal jurisdiction cases. In other areas of law the trend of the cases allowed a state to assert jurisdiction over someone outside the sate for any act directed intentionally towards a state, which a sale of goods for delivery in a state would include. This principal was eventually articulated directly in the personal jurisdiction context. See, e.g. World-Wide Volkswagen Corp., 444 U.S. 286 (1980), and there had been every indication prior to National Bellas Hess that that was where it was going with the sales tax cases as well.
In South Dakota v. Wayfair, Inc. (U.S. 2018), the U.S. Supreme Court overruled Quill and Bellas and reverted the law to its pre-Bellas state. It noted its ruling for example, in a pre-Bellas case that:
[B]usiness “is in no position to found a constitutional right . . . on
the practical opportunities for tax avoidance,” Nelson v. Sears,
Roebuck & Co., 312 U. S. 359, 366.
The pre-Bellas rule continued in place for taxes other than sales taxes. For example, the U.S. Supreme Court held that “interstate commerce may be required to pay its fair share of state taxes.” D. H. Holmes Co. v.
McNamara, 486 U. S. 24, 31 (1988). In Wayfair, the U.S. Supreme Court noted of the clearest indications of the pre-Bellas rule in cases where the U.S. Supreme Court held that:
“[t]he imposition on the seller of the duty to insure collection of
the tax from the purchaser does not violate the [C]ommerce [C]lause.”
McGoldrick v. Berwind-White Coal Mining Co., 309 U. S. 33, 50, n. 9
(1940). It is a “‘familiar and sanctioned device.’” Scripto, Inc. v.
Carson, 362 U. S. 207, 212 (1960).
Why Is This Rare?
What keeps this situation from being more common? . . . given the
highly polarized nature of American politics and the tendency of
political parties to do everything they can to overturn any decisions
made by the opposite party when they gain a majority I'm a little
surprised that Justices aren't more prone to the same, regardless of
the general stigma against changing old precedents.
While there is intense partisan conflict in the U.S., most of that conflict is of one party relative to the other on the liberal-conservative scale, and not something absolute.
For example, while Loving v. Virginia (U.S. 1967) (legalizing interracial marriage) took a position squarely opposed by conservatives at the time and one that even Martin Luther King, Jr. was reluctant to openly push and many liberals were leery of, at the time, by the 1980s there were formerly segregationist Senators in Congress who had staff members who were in interracial marriages and the rightness of the legality of interracial marriage was universally conceded.
Essentially the same people were pro- and anti- legislation and legal action to reduce racial discrimination in the 1980s as in 1967, but the goal posts had moved.
In part, this is because a binding U.S. Supreme Court opinion has a strong tendency to change conventional wisdom and beliefs among the entire populace except in rare cases (e.g. abortion). And, in part, this is because notable U.S. Supreme Court rulings are usually lagging indicators of social and economic trends that are already well underway when they are decided.