As far as I have seen in the examples, inversion comes to emphasize something. In doing that such words like never, only, and ... are used.
Now is it correct to say:
"Mainly by the imagination does a discovery take place."
I see nothing wrong with this. The result is exactly as you suggest, emphasizing "imagination" over "discovery".
I would suggest replacing "by the imagination" with either of the following: