Burnt wires are usually the result of a loose connection. When a connection is not solid, wires can heat up. This can be an even bigger problem with high amperage devices (heater, stoves, etc.). This likely has been an issue for a long time, and finally reached the breaking point.
The problem with overheating wires, is that the issue becomes compounded over time. Through constant heating/cooling cycles, the connection can become looser, the wire can become brittle, and the resistance in the wire can be increased. The more the resistance of the wire increases, the hotter the wire gets. Eventually, the wire can get hot enough to burn off the insulation. When it gets to this point you hope the wire breaks causing a short (which will trip the breaker), or at least breaking the circuit so current can no longer flow. If the wire does not break, you could be in much bigger trouble if the wire gets hot enough to start a fire.
The fact that the ground is burnt, is concerning. Typically the ground should not be carrying current, and so should not be heating up. You'll want to check the heater for a ground fault, to figure out why current is flowing in the ground. Check to make sure the bare ground wires behind the thermostat are pushed to the back of the box, to prevent them from touching the bare terminals on the thermostat.
My advice to you, would be to contact a local licensed electrician. It's difficult to accurately diagnose issues like this, through the internet. An electrician will be able to explain the cause to you, and tell you what the options are to remedy this problem.