Assume (a) dualism and (b) that the correlation between physical properties and mental properties is metaphysically contingent.
Now, epiphenomenalism about human conscious states is not a very plausible position. It seems extremely plausible that some of our second-order beliefs about our conscious states, and indirectly many of our reports of these, are caused the conscious states. But in the case of non-human animals, this argument is not so compelling, because it is not clear that non-human animals have second-order beliefs about their conscious states. This can be true even if the non-human animals have beliefs about the mental states of other animals. So, given dualism, epiphenomenalism about non-human conscious states seems to me to be a live option, though it becomes less plausible the higher up the cognitive scale we go.
Say now that "epis" are those animals in principle capable of feeling pain and for which epiphenomalism about pain states is true. Then all the overt behavior of an epi can be explained without making reference to any pain states of it. Let's say Bambi is an epi, and let E be the evil, actual or not, of Bambi being in horrible pain in forest fire F at t1.
Now, suppose that E would be gratuitous, in the sense that God would not have sufficient moral reason to permit E. Since God would not have sufficient moral reason to permit E, he'd have to prevent it somehow. How? There are two options:
A. Prevent Bambi from being burned or from having the neural correlates of pain.
B. Prevent Bambi from feeling pain while being burned.
Which would we expect God to do?
Well, let's consider A first. How could God do that? Well, there are many possibilities. God could set up very different laws of nature. It's not clear whether that would be a benefit to Bambi, since with very different laws of nature, surely Bambi's species wouldn't have evolved, barring some weird miracles. Or God could prevent the forest fire, whether by inspiring the campers not to leave a smoldering fire or by causing a rainfall or in one of many ways. Or God could prevent Bambi from being in the forest fire, for instance by ensuring that Bambi finds nice leaves to eat on the other side of a river. Or God could prevent fire from burning Bambi, with Bambi being in the midst of the fire and unharmed (a type of miracle reported in the case of a bush and in the case of Shadrach, Meshach and Abednego in the Old Testament). Or God could prevent the nerve impulses from reaching Bambi's brain. Or God could just painlessly kill Bambi. There are many ways of God's doing A.
But there is another thing God could do, and that's B. He could apply a dualist anelgesic, leaving the neural functioning of Bambi intact, but just ensuring that the correlated pain simply does not occur. In case B, Bambi behaves exactly as if in horrible pain, but isn't.
Which would we expect God to do? There is a kind of elegant minimalism about B: it precisely targets the problematic aspect of the situation, while leaving intact the rest of the causal nexus, without any kind of fixing up of the causal nexus. I think we have the intuition that Providence would proceed by some economy of miracles principle that makes B elegant.
On the other hand, there is a consideration against B if there are human observers, in that the human observers will have the justified false belief that Bambi is pain. But that some action will give rise to a justified false belief in someone is a pretty weak (though real, I think) reason against the action.
I am not saying we should positively expect God to do B. But it wouldn't be very surprising if B turned out to be the best option at least on occasion.
This means that if one wants to argue that a particular instance of Bambi's apparently suffering horrible pain in a forest fire is a gratuitous evil, one needs to both argue that (a) the horrible pain would be a gratuitous evil, and (b) that if God existed, he would respond in manner A rather than in manner B. And the theist need only defend the disjunction: either there is a theodicy for the pain or God has prevented the pain.
But what if epiphenomenalism is false? Well, the elegant minimalism of B together with the fact that it is empirically just as we observe didn't require epiphenomenalism. It required the disjunction of epiphenomenalism with causal overdetermination. If pain behavior is causally overdetermined by pains and neural states, that's enough, because if God takes away precisely the pain, the pain behavior will remain.
However, I think we can modify the point to work, albeit less well, even without this disjunction. Let's grant that we're dealing with a species where pains really make a difference to overt behavior. Nonetheless, we do not know exactly how much of a difference it makes. It may only make a difference by contributing to second order beliefs about one's own pain states. But I would expect it is rare for a non-human animal's behavior to be observably affected by such second order beliefs, especially in the case of severe pain (which is surely the most problematic case). An animal in severe pain is surely not primarily moved by second order beliefs.
And it might be that even given physicalism (about non-divine minds) something like the above might work. For God would know the true physicalist theory, and would know exactly what would need to happen for a neural state to be a pain. Then the analogue to option B would be God's making the minimal modification to Bambi's neural state so as to ensure that that neural state is not a pain. And it is quite epistemically possible that the resulting neural state would be very hard for us, and perhaps impossible for us, to distinguish from a pain.
So, what's the upshot? It's just that I think in the problem of animal pain we really need to ask ourselves: How would we expect God to prevent gratuitous pains? And then the argument from animal pain needs to take these answers into account.