I don't read anything startling but you may want to make an appt. with your regular doctor to have your lungs checked. It's not normal to cough up thick stuff for over 2 weeks. It wasn't clear how long the pain lasts when it occurs.
The doctor figured out your arrhythmia and thought it wasn't life threatening. However, a good doctor would have explained exactly what your heart was doing and why it wasn't dangerous rather than leave you wondering.
I agree with Flycaster (of course) in that heart related pain is usually more of a heavy pressure. On the occasions I've had chest pain it felt like someone grabbed my heart and just squeezed or was trying to pull it out through my back. Kind of icky.
I've got a history of cardiac issues, including heart attacks, angina, and strange heart beats, and can tell you that never did I experience sharp, stabbing pain. Heart attacks/angina issues are generally a long lasting feeling of intense pressure, think on having a cement sack on your chest, and/or being extremely breathless.
Most arrhythmia issues are benign and given the fact you have had them checked out, I'd suggest you are experiencing stress issues. Almost everyone has some arrhythmia, sometimes people are symptomatic. If you faint, I'd take them seriously. It sounds like anxiety is an issue. Keep us informed.