The most likely cause of this pain is when a nerve gets trapped for a short time in the muscles around your ribs. It can be a sharp pain and goes away quickly. It can happen with deep breaths or without. It is not usually a problem. If this persists or gets worse in intensity, you may need to see a physician for an evaluation of the pain.
I don't think that is necessarily related to your heart. I've had those occassional sharp pains and it does sound like a nerve. Sometimes moving positions makes it better. Like something isn't lined up perfect, or getting pinched.
I personally have an irregular heartbeat and it is not sharp pains. It is a heaviness, sometimes a fluttering, but not sharp pains. And it is always in one spot, right atop my heart. Not around the ribcage.
The Content on this Site is presented in a summary fashion, and is intended to be used for educational and entertainment purposes only. It is not intended to be and should not be interpreted as medical advice or a diagnosis of any health or fitness problem, condition or disease; or a recommendation for a specific test, doctor, care provider, procedure, treatment plan, product, or course of action. MedHelp is not a medical or healthcare provider and your use of this Site does not create a doctor / patient relationship. We disclaim all responsibility for the professional qualifications and licensing of, and services provided by, any physician or other health providers posting on or otherwise referred to on this Site and/or any Third Party Site. Never disregard the medical advice of your physician or health professional, or delay in seeking such advice, because of something you read on this Site. We offer this Site AS IS and without any warranties. By using this Site you agree to the following Terms and Conditions. If you think you may have a medical emergency, call your physician or 911 immediately.