The term "Pain in the neck." comes from the physical results of a stressful situations. When you are tense, stressed or worried about something the muscles in your shoulders and neck become tense and start hurting. So when you are in a stressful situation you say "It's a pain in my neck" (even if it isn't) to explain just how bad a situation it it.
Those are just my thoughts, hope it helps.