The terminal became loose and sparked.
Sparks raise the temperature so the resistance increases so it sparks more & gets hot enough to melt the lead ( ~ 700 deg )
You can buy a lot of arc welding sets that will weld steel which run off a car battery.
SO you might get by with cleaning the battery & wire really well then drilling a new hole or filing to old one enough to get purchase with a nut bolt and some washers.
Clean the other end of the cable and the bolt where it grounds .
When all done up tight paint it over with liquid electrical tape.
This will both stop the bolts working loose and corrosion forming.