Ulcers are commonplace with all humans. It's likely just the after effect of a small cut or scratch in the gum lining of the mouth.
For when I get ulcers or small inflamed cuts in my mouth, I normally take a dab of strong alcohol and apply it straight to the ulcer. It should heal up in a few days after that. If you'd rather, you could also use antiseptic mouthwash like Listerine.
Cold milk in the mouth around the area of the ulcer can also help soothe the pain. Cold water or ice applied before meals can soothe the pain enough for eating.
If it stays for more than week, see your general practitioner but buy the sounds of it, it's going away fine on its own.