The fact that you feel hot and cold indicates you have a chance to save the tooth particularly if the cavity is small but you need to stop food being trapped there particularly sugars. Fillings or fissure sealants can block food being trapped and can han have a temporary filling to make sure that the tooth heals up and is no longer sensitive to hot or cold.
You need to see a dentist. The cavity and pain will only get worse. Until then some sort of pain reliever (asprin, ibuprofen) may relieve some of the discomfort, but ultimately, you will have to seek dental care.
You need to be seen by a dentist. If you are having pain to heat that means the nerve is becoming involved. Nothing will fix it except to take care of the cavity and letting it go will wind up giving you a terrible toothache, or worse the loss of the tooth.
Please don't let it go. Make an appt ASAP.
Best to you,
Gellia