1) Pain can aggravate hypotension, so painkillers may help to prevent shock.
A severely wounded person with significant blood loss can develop hemorrhagic shock due to drop in blood volume and consequently drop of blood pressure and insufficient perfusion of vital organs.
It is known that pain can trigger vasovagal syncope, also known as neurocardiogenic syncope in which a person faints due to sudden drop of heart rate and arterial vasodilation resulting in drop of blood pressure and reduced brain blood perfusion.
Here is an example how carbamazepine, which prevented pain, also prevented the episodes of neurocardiogenic syncope (The Korean Journal of Pain):
A 65 year-old male patient diagnosed with glossopharyngeal neuralgia
complained of severe paroxysmal pain in his right chin and ear
followed by bradycardia, aystole and syncope. We report a case
successfully treated with a permanent pacemaker and carbamazepine in a
patient with GPN who had syncopal attacks preceded by paroxysms of
pain.
In an injured person who is at risk to develop hemorrhagic shock, severe pain could cause neurocardiogenic syncope that could proceed into shock, so, it sounds logical that painkillers could help to prevent shock.
From the first quote in the question (the patient was convinced he was receiving a strong painkiller), we cannot conclude that the painkiller prevented shock, because this has not even started to develop.
2) Analgesics for a person in severe pain who has lost blood and is in danger of developing shock.
According to Pain Control in Trauma Patients (Trauma Reports, 2011, fentanyl can be appropriate painkiller in shock since it does not aggravate hypotension:
Fentanyl is the best known synthetic agent and is widely used in pain
control. It is 50 to 100 times more potent than morphine and has the
added benefit of not causing histamine release and peripheral
vasodilation, as found with morphine administration. Based on this
physiology, fentanyl should not impact blood pressure as much as other
narcotics and, therefore, is preferential in the critically ill trauma
population who may have tenuous cardiovascular status from hypovolemic
shock.
Morphine can cause hypotension, so it may aggravate shock. According to prescribing information for morphine sulfate oral solution by FDA.gov, 2018:
In patients with circulatory shock, Morphine Sulfate Oral Solution may
cause vasodilation that can further reduce cardiac output and blood
pressure. Avoid the use of Morphine Sulfate Oral Solution in patients
with circulatory shock.
In conclusion, painkillers may help to prevent shock by reducing pain.