Your lungs have a lining called the pleura. There are basically two linings one is connected to your ribs this is called parietal pleura. This is the lining that covers the interior part of the ribs and diaphragm. The second lining is called the visceral pleura this pleura is on the exterior of the lungs. Sometimes when you get an acute infection such as the flu you can develop a condition called Pleurisy. Basically what happens is inflammation develops between the two spaces. Their purpose is to lubricate the exterior of the lungs and the ribs so that when your lungs move it would be like 2 pieces of satin rubbing together. When you get inflammation in the pleural space rather than gently lubricating it can cause severe pain.
Although people with pleurisy generally have some pain when breathing or especially taking a deep breath, it can also cause pain while coughing, sneezing, moving or when taking a deep breath. Since the pleura is also part of the diaphragm it can cause pain in the upper abdomen, flanks and any place where internal thoracic organs are connected to the body.
The pain is often sharp and intense but will resolve shortly after the sneeze, cough or deep breath. The treatment for pleurisy is based mostly on treating the underlying cause. For example if you have pneumonia or a bacterial infection, antibiotics can help to alleviate the bacterial infection and then the pleural effusion will in turn become better. For pleurisy involving a viral infection there isn't a whole lot that can be done since antibiotics are ineffective for viral infections. These types of pleural effusion usually resolve on their own with time.
Over the counter NSAID's such as Motrin can help to alleviate some of the symptoms of pleurisy. If you are continuing to cough and the pain is severe your doctor may want to prescribe you codeine for the pain. Codeine also works as a cough suppressant and will help stop the painful coughing. It is rare that pleurisy requires hospitalization but it would depend upon the underlying illness. For example, if you were to have a severe case of pneumonia hospitalization could possibly be necessary to drain the excess fluid that has accumulated in the pleural space.
If you are running a fever or become short of breath it is imperative that you get to your doctor or an emergency room right away. On some occasions the fluid itself can be infected with a bacteria and may require treatment but again it is rare in otherwise healthy people.
Since you have no medical history it is doubtful that you have a condition such as pancreatitis or any other abdominal issue. If this were the case you would generally have constant abdominal pain rather than just pain when coughing or sneezing.
Depending on how severe your flu was and how bad you were coughing it is possible that you pulled a muscle or are sore from all the coughing. I know it sounds a bit ridiculous to have pain so severe that you feel like you are going to collapse just from a pulled or strained muscle but it does happen. Every time you cough or sneeze you are putting more strain on an already injured area. If this is the case it should go away on its own within a few days and NSAID's would also help the inflammation in this case as well.
It is not a bad idea to call your doctor tomorrow and let him/her know what is going on. Most doctor's aren't open on the weekends and he/she may want to examine you to ensure that you are ok. A chest X-ray and lab work may be ordered depending on the severity of the pain.
Again if you develop a fever, shortness of breath or severe, constant unbearable pain then you may need to see a doctor immediately. If this happens and your doctor's office is not open you will want to go to the emergency room or an immediate treatment center. Most cities have immediate treatment centers and they are similar to hospital emergency rooms or after hour doctor's offices.
Also pleurisy can affect either one side alone or both. It all depends on the underlying cause.
If you want to read more about any of the terms in blue all you have to do is to click on them and it will take you to the links. I hope that you feel better soon.