Hi...the ulcer is due to the irritation caused by the sharp cusp of the upper third molar and due to the insufficient space for the lower third molar tooth/wisdom tooth to erupt.The pain is more due to constant food accumulation and infection in the affected area.
Next Steps
Visit dentist immediately and get evaluated through radiographic investigations .
Health Tips
Add salt in luke warm water,gargle in the affected side 4 times a day to get temporary relief.
Advised to do regulardental check up and teeth cleaning every 6 months.