When the FAA denies an airman's application for a medical certificate based upon an admitted condition that is disqualifying under 14 C.F.R. Part 67 (e.g. heart disease, epilepsy, bipolar disorder, diabetes requiring insulin, etc.), an appeal will, in almost all cases, be unsuccessful. In that situation, the airman has the burden of proving that the airman is qualified to hold a medical certificate. That's a tough thing to accomplish if the airman has already admitted that he or she has a condition that is specifically identified as disqualifying under the regulations.
If an airman is denied based upon a disqualifying condition, but the airman believes he or she is otherwise qualified, the airman should request that the FAA grant a special issuance medical certificate pursuant to 14 C.F.R. §§ 67.115, 67.215 or 67.315 (depending upon the class of medical for which the airman is applying). A special issuance is a medical certificate that has limitations and/or conditions with which the airman must comply in order for the certificate to be valid. The conditions/limitations will often include regular testing or evaluation, test results within acceptable ranges, no changes in medication etc.
If the FAA refuses to grant an airman's request for a special issuance, the airman may appeal that denial to the NTSB. However, since the Board defers to the FAA's discretion in denying a special issuance, the only way to be successful is to show that the FAA's denial is arbitrary or capricious. For example, if a denied airman can prove that the FAA has granted a special issuance in circumstances that are very similar to or identical with those of the airman, then an ALJ may be convinced that the FAA's denial in the airman's case is arbitrary or capricious. As a practical matter, however, this can be a very difficult task.
If you have a medical condition that may disqualify you from obtaining a medical certificate, get help before you apply for your medical certificate. Talk to an aviation attorney or the medical certification professionals at AOPA or NBAA. By taking a pro-active approach and getting help, you will be able to "pick your battles" wisely to maximize your chances of successfully obtaining a medical certificate.