What has most likely happened is that something sticky was eaten and then the filling, or some of the filling has come out. Another option is that when the tooth was filled the dentist did not get the whole cavity. A portion of the cavity may still be showing.
The filling material is to "high" for the tooth surface. Thus causing brusing at the root area from the tooth when chewing. The bite is corrected by using articulation paper, a patient bites down a mark will show on the tooth. This is the area that need to be smoothed.
It is possible that you have an exposed nerve (likely from a larger filling/drilling). The pressure of biting pinches the nerve and pain is the result. If it continues, it's likely you would need a root canal.
Sorry to hear that you are in so much pain. Please contact your dentist as this may be an interface on the sliding - this means there may be a small stone in your filling or your filling may not be fitted for your upper teeth. Before leaving the dentist, bite down a little to makes sure you are comfortable.