It is certainly true that the court system has played a critical role in the protection of American civil liberties. You need only look at Supreme Court cases such as Brown v. Board of Education or, more recently, Obergefell v. Hodges to see the lasting effect the courts have had in this respect.
It is not by accident, however, that the courts have played such a key role. In fact, you can argue that it is precisely because the federal court system is appointed rather than democratically elected that the courts have been able to have this effect. To be democratically elected means that the first and foremost goal of many politicians will be to win elections, which means appealing to their constituents and winning popular support. This raises the problem known as tyranny of the majority, by which what is popular will not necessarily be what is fair or just. Often, within a democracy, the most vulnerable populations are going to be minorities and marginalized communities. At the same time, the electoral process also ties politicians more closely to the influence of party and special interests, as winning elections often requires money and political influence to be spent in a politician's favor.
By being non-elected, the courts tend to be significantly less political than the other branches of government, and while there remains a division between conservative and liberal judicial theory, the fact remains that judges are not beholden to party and voters in the same way elected politicians inevitably tend to be.