In 1996, the Supreme Court struck down an amendment to the Colorado state constitution that would have unfairly singled out gay people and prevented any attempt to view them as a protected class - meaning there would have been no way to protect gays from discrimination of any kind through legislation, the courts, or through any other method.
In Romer v. Evans, the majority opinion noted that there was no reason to amend the constitution this way, beyond animus toward the gay community. The court essentially said that the reasons given for the amendment didn't sufficiently explain the need for the amendment. Simply, it was found that they wanted to amend the constitution out of meanness and disapproval of the gay community. The court decided that there was no legitimate state interest for this amendment.
Writing for the majority, Justice Kennedy said:
This disqualification of a class of persons from the right to obtain specific protection from the law is unprecedented and is itself a denial of equal protection in the most literal sense. Second, the sheer breadth of Amendment 2, which makes a general announcement that gays and lesbians shall not have any particular protections from the law, is so far removed from the reasons offered for it, i.e., respect for other citizens' freedom of association, particularly landlords or employers who have personal or religious objections to homosexuality, and the State's interest in conserving resources to fight discrimination against other groups, that the amendment cannot be explained by reference to those reasons; the Amendment raises the inevitable inference that it is born of animosity toward the class that it affects.
To the argument that the only thing the amendment would do is keep gays from obtaining special rights:
In our view that does not resolve the issue. In any event, even if, as we doubt, homosexuals could find some safe harbor in laws of general application, we cannot accept the view that Amendment 2's prohibition on specific legal protections does no more than deprive homosexuals of special rights.
Kennedy said that the only way a law like that could be upheld is if there were a rational state interest for the law. In this case, the only reason for the amendment was dislike of gay people, thus it is not constitutional. So when some say that there's no "bad idea" clause in the Constitution, that isn't entirely true because the law is required to fit this standard of review. Indeed laws can be passed that are bad ideas, but not without some rational basis other than hate.
Romer v. Evans was a landmark case in gay rights, argued by lawyers with the private law firm Hogan & Hartson, including pro bono work by a young attorney named John Roberts, paving the way for the 2003 case Lawrence v. Texas, in which a law banning sodomy was struck down and a different standard of review was used limiting the state's intrusion on privacy rights.
Dissenting in Romer, of course, Scalia worried about issues of morality. He suggested that it was a bad idea to overturn this amendment, because the state had a reasonable interest in limiting sexual mores. He said that it is not rational to criminalize homosexual activities and then offer protections against the people inclined to participate in that type of sexual activity. Scalia noted his fear that the decision could erode what he called the "sexual morality" that the majority of people in Colorado favored. He stressed in his opinion that there could be a slippery slope with the decision.
Later, in 2003, the Supreme Court struck down a Texas law banning sodomy. This ruling created new precedent when coupled with the Romer decision by overturning a 1986 ruling (Bowers v. Hardwick.) The court recognized that their previous ruling in Bowers was too narrow and that sexual conduct is a freedom protected by the fourteenth amendment.
Gays are not the only group who practice sodomy, of course, but the laws were an attempt to criminalize homosexual activity and stigmatize gays so much that it would perhaps make gays conform to heterosexual ideals. Or at least keep them out of sight, always feeling like they were "different" and must hide their proclivities. In a dissent to Bowers, the 1986 case, Justice Stevens said, "[I]ndividual decisions by married persons, concerning the intimacies of their physical relationship, even when not intended to produce offspring, are a form of 'liberty' protected by the Due Process Clause of the Fourteenth Amendment. Moreover, this protection extends to intimate choices by unmarried as well as married persons."
In the Lawrence decision, this argument was the main part of the majority opinion. The court had already decided in the Griswold case that a fundamental right to privacy exists in the Constitution. Though it's not explicitly mentioned, the concept of privacy is touched on in the Bill of Rights - for example, the fourth amendment protects against searches and seizures without a warrant, implying that people are entitled to be left alone by the government without a reasonable justification to do otherwise.
The Lawrence decision effectively applied that concept to sexual activity - including sodomy - among consenting people.
Stevens' dissent in Bowers, and the majority opinion on Lawrence essentially said that people have the liberty to have sex even without the intention of producing children and even without being married, which meant that the state has no reason to burden private citizens with an invasion of their privacy and regulation of their sexual activity - whether it's opposite sex or same sex couples.
Lawrence v. Texas held that Bowers was not an appropriate or correct ruling and set a new precedent which was less of an infringement on private conduct.
Scalia, again fearful of the destruction of sexual morality, said in his dissent, argues that morality is a legitimate state interest that can rationally be regulated by the government.
And then it gets interesting. He describes his fear of a slippery slope that he believes will come from that decision:
State laws against bigamy, same-sex marriage, adult incest, prostitution, masturbation, adultery, fornication, bestiality, and obscenity are likewise sustainable only in light of Bowers’ validation of laws based on moral choices. Every single one of these laws is called into question by today’s decision; the Court makes no effort to cabin the scope of its decision to exclude them from its holding.
A later case, Muth v. Frank, determined that incest doesn't deserve that broad of an interpretation, so he was at least incorrect there.
And then, he argued:
One of the benefits of leaving regulation of this matter to the people rather than to the courts is that the people, unlike judges, need not carry things to their logical conclusion. The people may feel that their disapprobation of homosexual conduct is strong enough to disallow homosexual marriage, but not strong enough to criminalize private homosexual acts–and may legislate accordingly. The Court today pretends that it possesses a similar freedom of action, so that that we need not fear judicial imposition of homosexual marriage, as has recently occurred in Canada (in a decision that the Canadian Government has chosen not to appeal). See Halpern v. Toronto, 2003 WL 34950 (Ontario Ct. App.); Cohen, Dozens in Canada Follow Gay Couple’s Lead, Washington Post, June 12, 2003, p. A25. At the end of its opinion–after having laid waste the foundations of our rational-basis jurisprudence–the Court says that the present case "does not involve whether the government must give formal recognition to any relationship that homosexual persons seek to enter." Ante, at 17. Do not believe it. More illuminating than this bald, unreasoned disclaimer is the progression of thought displayed by an earlier passage in the Court’s opinion, which notes the constitutional protections afforded to "personal decisions relating to marriage, procreation, contraception, family relationships, child rearing, and education," and then declares that "[p]ersons in a homosexual relationship may seek autonomy for these purposes, just as heterosexual persons do." Ante, at 13 (emphasis added). Today’s opinion dismantles the structure of constitutional law that has permitted a distinction to be made between heterosexual and homosexual unions, insofar as formal recognition in marriage is concerned. If moral disapprobation of homosexual conduct is "no legitimate state interest" for purposes of proscribing that conduct, ante, at 18; and if, as the Court coos (casting aside all pretense of neutrality), "[w]hen sexuality finds overt expression in intimate conduct with another person, the conduct can be but one element in a personal bond that is more enduring," ante, at 6; what justification could there possibly be for denying the benefits of marriage to homosexual couples exercising "[t]he liberty protected by the Constitution," ibid.? Surely not the encouragement of procreation, since the sterile and the elderly are allowed to marry. This case "does not involve" the issue of homosexual marriage only if one entertains the belief that principle and logic have nothing to do with the decisions of this Court. Many will hope that, as the Court comfortingly assures us, this is so.
Essentially, Justice Scalia is arguing that the decisions in Romer v. Evans and Lawrence v. Texas completely eliminate any legitimate state interest for banning gay marriage. He was, of course, probably screaming in terror as he wrote it, but there it is. And Justice Kennedy wrote favorable opinions for the gay rights side in those cases.
In short, while the current make up of the Supreme Court is probably not extremely supportive of our issues, the legal rationale for coming around to our point of view DOES exist in previous cases.