Any thought is material in nature, so I believe that matter came first.
P.S. I read that some mathematician-priest was able to derive some intricate formula and prove that the probability of God's existence is 60% (I became curious myself). Does anyone know anything about this?