Hello,
Welcome to the ehealthforum and I am really glad to help you out. This kind of lump can be a swollen lymph node, a cyst, a swollen muscle, a benign growth or a boil. Lymphadenopathy (swollen lymph nodes) is usually caused by a viral or bacterial infection along with other numerous causes. Cyst is usually painless but can become painful if infected. Boils are caused by infection of the hair follicle be staph aureus. Even swelling or inflammation of the muscles can sometimes cause painful lump.
Given your history of headaches, what exactly is this can be diagnosed only after examination and investigations like MRI or CT of the area. Till that time you can apply warm compresses and take some anti inflammatory pain reliever.
It is very difficult to precisely confirm a diagnosis without examination and investigations and the answer is based on the medical information provided. For exact diagnosis, you are requested to consult your doctor. I sincerely hope that helps. Take care.