A toothache can be from a varitey of problems. Once a tooth begins to hurt, this indicates that the pulp (or nerve) of the tooth is irritated. This can be from a crack in the tooth, a gum condition, a cavity or other conditions. The treatment options range from a filling, to a root canal, a deep cleaning, or an extraction. Only a dentist can properly assess the situation, and the more it is delayed, the worse it can become!
The most common reason is that the pulp (or nerve) of the tooth is inflamed. The most common sensitivities following a restoration are to cold and biting. The cold sensitivity will usually go away after a couple of weeks, but if the tooth is sensitive to biting it needs to be adjusted by the doctor. In some cases, the pulp may be irreversibly damaged by the decay that was present prior to the filling. In this case, the new filling has sealed the tooth so well, that the pressure builds inside the tooth and a root canal may be necessary.