One can say only God knows in reference to some mystery only an omniscient being would know, or for those who prefer their oaths minced, heaven knows or goodness knows or lord knows.
The inverted form God only knows is also very common. But if read in usual English word order, it means something different, that God knows to the exclusion of anything else— God "only knows," and doesn't see, hear, act, etc.
Why and how then do we say God only knows? Is it a mangled quotation, a holdover from archaic English, or something else?