When a tooth gets a cavity
it is trauma, then we fill it and that is more trauma.
The tooth is sensitive for up to 6 weeks while it lays down scar tissue to protect itself from the trauma. Healthy teeth will heal however sometimes the trauma exceeds the tooths ability to heal. If the sensitivity lasts more than 10 sec before returning to normal see your dentist.