Rambam writes in his introduction to Mishneh Torah:
וכן אם למד אחד מהגאונים שדרך המשפט כך הוא ונתבאר לבית דין אחר שעמד
אחריו שאין זה דרך המשפט הכתוב בגמרא אין שומעין לראשון אלא למי שהדעת
נוטה לדבריו בין ראשון בין אחרון
Similarly, if one of the Geonim interpreted the path of judgment in a
certain way, while the court which arose afterward interpreted the
proper approach to the matter in a different way, the [opinion of the]
first [need] not be adhered to [absolutely]. Rather, whichever
[position] appears to be correct - whether the first or the last - is
accepted. (Chabad.org)
In a responsum (Pe'er Hador # 47) he also explicitly states that we do not have to rule in accordance with the Gaonim – if we are following what appears to be the law from the Talmud, we don't care if the Gaonim reached a different conclusion.
ואם הגאונים כתבו דברים אחרים מה איכפת לן מהנראה מהתלמוד הוא כך ואין
צריך לפסוק כסברתם דוקא
R. Isaiah of Trani discusses arguing with early authorities in two of his responsa (Shu"t HaRid #1 and # 62).
He essentially says that though we acknowledge that our predecessors are much greater than us, we can still disagree with them, in line with the Amoraic exclamation in Chullin 124a.
א"ל האלהים אי אמר לי יהושע בן נון משמיה לא צייתנא ליה
‘By God!’ said R. Ammi, ‘even if Joshua the son of Nun had told it me
by his own mouth I should not have accepted it!’ (Soncino translation.)