The Ptolemaic conception of the universe, in which everything revolved around a stationary Earth, relied on positing “epicycles” to explain any irregularities. Ptolemy himself employed them to explain why the five planets (“wanderers”) and the moon headed off in a different direction from the stars (while some Jewish writers thought they were “wandering” because they must be, unlike the good angels/stars, rebellious angels).
By the time of Copernicus, with the growing advance in astronomical knowledge, a great many epicycles and other such tweakings and adjustments were required to continue to believe in a geocentric (earth-centred) universe.
Epicycles have thus become a great image for any ad hoc explanation that is employed in order to sustain belief in an existing paradigm which has become full of holes.
As ingenious as the epicycle calculations were, they do not match the attempt, in 1893, by Prof. Orlando Ferguson (a real estate developer based in South Dakota, USA) to reconcile the Bible’s dominant belief in a flat Earth with the scientific consensus of his day that it was a globe. The full story is in Live Science, 23 June 2011. This really is ingenious:
The Flat Earth theory of the universe: Teach both sides of the controversy!