In Chief Justice John Marshall's groundbreaking opinion in the case of Marbury v. Madison, he ruled against his own Federalist Party. The immediate result of that opinion was that Marshall's fellow Federalist, William Marbury, would not be able to take office as a federal justice of the peace.
However, his party may have lost the battle, but won the war. By asserting the power of judicial review, the Federalist Marshall guaranteed that he would have significant influence over the Republican-controlled executive and legislative branches of the federal government, even after the 1800 election, in which his party had suffered a repudiation from which it would never recover.
The judicial branch has often sidestepped issues that it has deemed to involve political questions. In his Marbury opinion, Marshall stated that "questions, in their nature political ... can never be made in this court." But cases, including that one, have political implications. And the political-question doctrine has been weakened in recent times, e.g., by the legislative reapportionment cases in the 1960s.
Two cases come to mind, in which justices have ruled against the interests of the political party of the president who appointed them.
The first is the Supreme Court's 1974 decision in the case of U.S. v. Nixon. The court unanimously required the Republican President Richard Nixon to reveal tape recordings of conversations related to the Watergate scandal. That decision was the straw that broke the camel's back, forcing Nixon to resign shortly thereafter. Two justices who had been appointed by the Republican President Dwight Eisenhower, plus three justices appointed by Nixon himself, ruled against the president. A fourth Nixon appointee, William Rehnquist, then an associate justice, took no part in the decision, because he had worked in Nixon's administration.
That's an extreme example, being a unanimous opinion. Even Republicans in Congress had begun to turn against Nixon, so it's no surprise that Republican-appointed justices joined in the unanimous opinion.
A more interesting example is one of the most controversial 5-4 decisions in Supreme Court history. I refer to the 2000 case of Bush v. Gore. The decision halted recounts of the Florida presidential vote, thus ending Democrat Al Gore's hopes of erasing Republican George W. Bush's slim lead for the decisive Florida electoral votes. Two of the four dissenting justices (i.e., those favoring Gore's position) had been appointed by Republican presidents. John Paul Stevens was chosen by Gerald Ford. And David Souter had been nominated by candidate Bush's own father, George H.W. Bush. There was some talk at the time of Souter betraying the Bush family, but that point of view runs counter to the independence that the Constitution provides to the judiciary.
Aside from these questions that have direct partisan political implications, presidents are frequently disappointed in the positions that their appointees take, once they're on the Supreme Court.
Souter, who is in the process of retiring, has caused bigger headaches for Republicans than just his dissent in Bush v. Gore.
I've written, in a series of posts that began here, about how slippery the words "liberal" and "conservative" are, when applied to the political branches of government. My opinion is that it's even more difficult to apply those labels to judges but, of course, people do.
Souter is generally considered to be part of the liberal faction on the court, as is Stevens. What angers many Republicans most, is Souter's role in upholding the Roe v. Wade decision on abortion.
One of George H.W. Bush's Republican predecessors, Dwight Eisenhower, also regretted at least one of his Supreme Court appointments. There was a vacancy in the position of chief justice, early in Eisenhower's first term. Eisenhower made what must at the time have seemed a safe choice, appointing the Republican governor of California, Earl Warren.
According to some reports, Eisenhower later called that nomination "the biggest damn fool mistake I ever made". That view seems, at least in part, to have arisen from the Warren Court's 1954 Brown decision on school integration. However, Warren's record on such issues as criminal procedure, school prayer, legislative redistricting, interracial marriage, etc., may have contributed to Eisenhower's view.
By the time of the Brown case's 50th anniversary in 2004, politicians of both parties were ready to heap praise on Warren and his colleagues. But Eisenhower's negative view of that decision reflects how controversial the court's decision was in the 1950s and beyond.
Another Eisenhower appointee, Associate Justice William Brennan, was long considered a bulwark of the Supreme Court's "liberal wing", and that was probably another nomination Ike would not make, if he had it to do over again.