Here's the lowdown but with the usual disclaimer: This should not be construed as medical advice or a substitute for consultation with your own physician. I speak only in generalities.
With that out of the way...
The issue with NSAIDS really has more to do with your kidneys than with your stomach. While it is true that NSAIDS (Alleve, Advil, Indocin and the like but NOT Tylenol) can cause stomach upset and ulcers with chronic use, they are unlikely to give you a lot of problems as long as you stay within the recommended dosage on race day. Kidney issues are a potential problem though even when these drugs are used at the correct dosage. All NSAIDS have the potential to induce renal injury but the risks of this are significantly increased in the setting of dehydration. There is also a theoretical risk associated with prolonged exertion leading to muscle breakdown (unrelated to the NSAIDS but the combination can worsen the effects on the kidney). All this to say that NSAIDs are
potentially harmful when used during endurance events.
If you do choose to use them, NEVER use more than the recommended dosage and ALWAYS be sure to stay maximally hydrated.
As for the use of narcotic painkillers, this is technically illegal (operating a bicycle while impaired by painkillers is considered DUI) is potentially very dangerous to you and those around you and may be considered doping (though I cannot attest to this last part. I am unsure if opioids are on the list of banned substances). I certainly would not advise this and as one other person mentioned, it has the potential to lead to injury as you are blunting your pain response and thus liable to overexert.
I hope this helps.
Cheers
Jeffrey Sankoff, MD
TriDoc Coaching/TriDoc Podcast
Train hard, train healthy
http://www.tridocpodcast.com http://www.tridoccoaching.com