The problem that you have described is most likely due to the wisdom tooth. Removal of this problematic tooth is the permanent solution.
Next Steps
visit your dentist atthe earliest to get it removed.
Health Tips
to relieve pain you can take a pain killer tablet and also rinse your mouth rigorously with warm salt water.