A word for a wild, uneducated, random guess that turns out to be correct

Solution 1:

fluke

NOUN

An unlikely chance occurrence, especially a surprising piece of luck.
‘their victory was a bit of a fluke’

Solution 2:

Wild guess is a perfectly fine phrase, but if you don't like that one, I'd suggest a shot in the dark:

A shot (or stab) in the dark

PHRASE

An act whose outcome cannot be foreseen; a guess.
‘their experiments were little more than shots in the dark’

Solution 3:

You might say,

He really caught lightning in a bottle that time!

The idiom catch lightning in a bottle refers to succeeding at an extremely difficult task—usually through a single stroke of great luck or through a remarkable series of individually minor instances of good luck.

The expression alludes to the Benjamin Franklin kite experiment, but it seems to have first became idiomatic in U.S. baseball, in reference to a team or player that, against all expectations, plays at a very high level. The downside of the expression is the implication that the player or team is likely to revert to the mean (that is, to mediocrity) when the stroke or run of good luck ends.

Solution 4:

"Lucky guess."

An apparently unreasoned guess that turns out to be correct may be called a happy guess, or a lucky guess, and it has been argued that "a 'lucky guess' is a paradigm case of a belief that does not count as knowledge".

Emphasis mine.

Solution 5:

Beginner's luck is an appropriate idiom here -- colloquially, it refers to the success a novice may have, even though it is clearly not due to skill or knowledge.

A more strict/scientific discussion of beginner's luck is here, and I'd say it's used the most colloquially referring to things like games, but I can't imagine that your meaning wouldn't be taken as it's common in casual conversation. https://en.wikipedia.org/wiki/Beginner%27s_luck