Yes, you can get it that way. Syphylis is caused by treponema pallidum which can even go through healthy skin sometimes. Not to mention if you have even a small lesion in your mouth. It can be found in the body's secretions, and as you came to contact with them, it's not too good i'm afraid. However, there is a chance that you became infected.
If I were you I would go to the doctor's asap.
Good luck!