Hello - I am sorry that your little boy is not feeling up to snuff! It does, in my opinion, sound like he has parasites. Pinworms will cause nausea and restlessness at night. As for the light sensitivity - toxoplasmosis will cause this. It can be present in a child from birth and the symptoms may not show themselves for a while. I am not saying he has toxoplasmosis - but it might be something worth researching.
The strange colored stool indicates toxins being removed from the body - these toxins can make a person very ill when they are coming out of the body. Vomiting and diarrhea are two of the fastest ways for the body to remove harmful things. Fever is another natural defense - many bacteria and viruses can't live above a certain temperature - so between all of these signs - something is definately going on with him.
I know you probably know all of this - but when doctors can't figure out why a person is ill - they like to use the old "viral infection" diagnosis. In my opinion, if your son's gas problems got better after his parasite cleanse - then his problems are most likely parasite related. parasite cleansing needs to be done 2-3 times per year - every year.
I do hope that you find the root cause to his illness - hang in there!