If there is an infection going on, the dentist will be able to prescribe something, not just painkillers.
All there gonna do is prescribe you some tylenol, when i was pregnant with my daughter 18 yrs ago my teeth and gums was hurting so bad they prescribe me tylenol 3's , so maybe if it's all the same they'll do the same for you. But you have let your doctor no before and then make your dentist appt. Goodluck with that i no how painful that can be.
See the dentist right away. You need to have no infections in your mouth for the healthiest pregnancy.
your dentist would be the best person to ask or a doctor.