This might be even more gross...one way to figure out what meal is prompting this is to give him something at each meal during the day that doesn't get, shall we say, digested all the way. I know for Tyler, corn and grapes come out the other end looking pretty much like they did when he ate them, so I know how long it takes for things to move through his digestive tract. If your DS has any foods like that, try giving him a different one at each meal and see what comes out during the night. Then you might have a better idea what meal is the culprit and see how to change things up. My guess is that it would be either lunch or dinner, and if you give him foods that move him along at breakfast, you may be able to reschedule him. Grown up oatmeal works wonders for us!
In the meantime, get yourself a really good diaper rash cream and slather it on super thick when you put him to bed, and give him some naked time during the day so that rash can have a chance to heal. Good luck!