Anytime there is chest pain present it can be alarming due to the possibility of cardiac problems. But, in your case, I would lean toward respiratory or gastro-intestinal issues. The persistent cough, along with the possible presence of lingering congestion, could be causing your upper airways and throat to be inflamed and sore. Also, there could be a possibility of a hiatal hernia. Frequent or hard coughing is a risk factor. I hope that you will consider seeing a physician. Good luck.
Seems to me like you have bronchitis. If your mucus is discoloured like dark yellow to dark green and you get it by coughing then you have a bad infection in your chest. The pain is probably due to the coughing and the irritation of the infection and inflammation. If the mucus feels like its coming from the base of your chest then it suggests that the infection is quiet low down your respiratory tract. If you have been feeling more tired or weak this would be the cause of it because you would be unable to transpport enough oxygen to the rest of your body causing fatigue. If you do have a respiratory infection and you chose not to be treated by a gp then you run the risk of pneumonia which would land you in the hospital eventually.
I suggest going to your gp and getting your antibiotics and steroids and getting over this by a week to 10 days, so that you don't have to feel like crap anymore.
You should check with your Dr. to be sure, but you could even have viral bronchitis which would cause the pain in your chest, or the lingering of a cold along with mild heartburn.