Remember, caffeine is not just in coffee, Mt. Dew and all the common items you think of when looking for caffeine. That Excedrin has as much caffeine as a cup of coffee. Some pain relivers can also cause rebound headaches, which give you headaches as you quit taking them.
It sounds like your issue is caffeine related and good for you for getting a handle on it.