Move over neural networks! – A new method for cosmological inference