Welcome to the forum!
The lump behind the ear that has been for years could be a cyst, lipoma (localized collection of fat), a cyst, a lymph node or a neurofibroma (localized harmless swelling in of nerve and connective tissue). Swollen lymph nodes behind your ears could be due to chest infection, tonsillitis or pharyngitis, dandruff, infection of ear or even metastasis from a cancer. It could also be of tubercular pathology. Since it has been long standing, the simplest explanation could be either dandruff or caries in tooth. Allergic cough or long standing allergies too can cause a lymph node.
A swelling behind the ear if has not increased in size is unlikely to be the cause of your headaches. The headaches could be due to migraine, tension headache, poor sleep, anemia, low or high blood pressure, pinched cervical nerves, or poor eye sight. Even dandruff in hair can cause headaches.
Discuss these possibilities with your doctor. It is difficult to comment beyond this without examining. Please let me know if there is any thing else and do keep me posted. Take care!
Is your wisdom teeth still growing out? because If you have an Impacted tooth on that same side, it can cause a swollen lymph node and also pain behind the ears. So if thats the case, just have your wisom teeth removed.