To answer the title question, we must first answer the logically prior question as to who the greatest philosophers were. But this presupposes an answer to the equally vexing question of who counts as a philosopher. Heidegger published two fat volumes on Nietzsche, but dismissed Kierkegaard as a mere "religious writer." Others will go him one better, dismissing both Kierkegaard and Nietzsche -- and Heidegger as well. Was Aquinas a philosopher? Or was he merely a brilliant man who used philosophical tools to shore up beliefs of an extraphilosophical provenience, beliefs that he wouldn't have abandoned even if he hadn't able to find philosophical justifications for them?
Note also that the question as to who counts as a gen-u-ine philosopher presupposes an answer to the hairy and hoary question as to what philosophy is.
In any case, here is my ranking of the philosophers that made it onto a BBC shortlist from a few years ago. The ranking is mine; the list is from the BBC.
1. Plato (c. 429-347 BC)
2. Aristotle (384-322 BC)
3. Thomas Aquinas (c. 1225-1274)
4. René Descartes (1596-1650)
5. Immanuel Kant (1724-1804)
6. Socrates (c. 470-399 BC)
7. Benedictus de Spinoza (1632-1677)
8. David Hume (1711-1776)
9. Epicurus (341-270 BC)
10. Thomas Hobbes (1588-1679)
11. John Stuart Mill (1806-1873)
12. Arthur Schopenhauer (1788-1860)
13. Søren Aabye Kierkegaard (1813-1855)
14. Friedrich Nietzsche (1844-1900)
15. Karl Marx (1818-1883)
16. Bertrand Arthur William Russell (1872-1970)
17. Ludwig Wittgenstein (1889-1951)
18. Martin Heidegger (1889-1976)
19. Jean-Paul Sartre (1905-1980)
20. Karl Raimund Popper (1902-1994)
Here are my criteria in order of importance:
1. Truth of the philosopher's conclusions
2. Belief in reason's power to discover some of the ultimate truth
3. Rigor of argumentation
4. Appreciation of the limits of reason
5. Depth and centrality of the problems addressed
6. Breadth and systematicity of vision
8. Long-term influence
The first seven philosophers on my list are great philosophers, the rest are important but not great. Kierkegaard, for example, though original and influential, and (too) appreciative of the limits of reason falls short on the other criteria.
It goes without saying that my ordering of the philosophers, my criteria, and their ordering are highly subjective. They reflect my interests, my biases, and my own philosophical conclusions. For example, my primary interest in a philosopher is not in his literary merit. If that is your primary interest, then you will probably rank Kierkegaard and Nietzsche ahead of Kant. Indeed, if you do not, then you have very poor taste!
You will notice that I am biased toward the rationalists. Thus all the philosophers I call great are either rationalists, or like Aristotle and Kant, have a strong rationalist side to their thinking. And when I list truth as my numero uno criterion, it is clear that that is truth as I take it to be.
On the score of truth, Nietzsche really falls short. For not only is there little if any philosophical truth in his writings, the poor soul denies the very existence of truth.
When one studies the first seven on the list, one actually learns something about the world. But when one reads Nietzsche and (later) Wittgenstein, one learns highly original and fascinating opinions that have little or no chance of being true. One learns from them, and from some others on the list, how NOT to do philosophy. But that too is something worth knowing! So they have their place and their use.
Now to our question whether the greatest philosophers were theists or atheists. The greatest philosophers on my list are Plato, Aristotle, Aquinas, Descartes, Kant, Socrates, and Spinoza. All of these are theists of one sort or another. But even if Spinoza is excluded, that leaves six out of seven. And if you argue that Aristotle's Prime Mover is not God in any serious sense, then I've still got five out of seven.
If you say I rigged my list so that theists come out on top, I will deny the charge and argue that I used independent criteria (listed above). But if you disagree my assessment, I will consider it par for the course.