I'll bet you anything, that plant is rootbound to hell. you say 40 days? how large is that pot? The wilting leaves looked like lack of light and they're the lower leaves so really the wilting did not cause the overall death.
you say it was really dry, but you didn't know why... try watering it?

idealy you need a 5 gallon pot for a marijuana plant. that pot looks far to small for the size/age of your plant.