Yes, more than a few people have survived shooting themselves in the head, the majority however do die. If you are concerned about shooting yourself in a way that results in no pain or should you survive but with no disability and disfigurement, you need to think about where you're aiming and with what kind of bullet. Location is the most critical factor in determining if a gunshot wound to the head is fatal. A shot through the brainstem is basically the most "instantaneous, lights out, painless" shot we know of. From the base of nostrils to the top of nose is inline with brainstem, and the ear basically sits right over the brainstem from the side, so a shot at the back of the mouth and angled upward so the bullet's trajectory is inline with where your nostrils and ear canal align would wreck the brainstem, assuming you don't angle the barrel of the gun slightly to one side of your mouth where it exits off center, is as "good, painless" shot you can get.
The next most important factor in determining if a shot is lethal is the amount of energy transferred to the body (measured in ft/Ibs). Ammunition designers approach this from a number of ways, like bullet caliber, velocity, mass, and shape. Energy is important because when a bullet encounters a body it slows down and all that energy is deposited in the body, which creates a shockwave around the bullet which is strong enough to instantly blend delicate organs like your brain (but not bone), and this happens around the cavity where the bullet itself punched through your body. The thing is if a bullet enters and then exits your body, it has not deposited all the energy it could, which means less internal damage and alot more external damage. If a bullet exits you have the chance to bleed to death which is VERY painful, not to mention it's left a visible, possibly disfigured hole in you. If the bullet slows down enough to stop in you, it will have deposited all its energy and not left a exit wound. Modern high quality nonfragmenting Jacked Hollow Points are designed to do this and more, when they enter the body they also expand making the bullet wider which guarantees even more damage.
Third, the larger the bullet caliber (width of the bullet before fired) the more lethal it's likely to be. Many people have taken their lives using the very common .22 caliber, but more people have survived using this caliber than any other (with varying amounts of disability and disfigurement). The 9mm and .45acp have far more lethality simply because they are alot wider than the .22, which on many occasions the .22 doesn't even penetrate the skull, and also the hollow points for the .22 are disproportionately weak. Shotgun rounds are often even wider than the .45, but have much, much more energy than 9mm or 45 handguns, so much so that they remove half a person's head or face when fired at any spot.
Shooting yourself in the heart can cause brain damage only through blood no longer being pumped to your brain, which would lead to damage and then death given enough time, but before you pass out from lack of blood to your brain, it will be fairly painful. Plus doctors can do alot more to keep you alive if your heart's damaged vs your brain.
A carefully placed shot through the brainstem using a 9mm or .45acp jacked hollow point has the highest lethality while having the lowest probability of being disfiguring or painful