First, just for the record, I'm going to posit that the 40,000 firearms deaths is a reliable figure because they will be listed as homicides and suicides in the "manner of death" section of death certificates, and they're all going to be medical examiner cases. So I have confidence in this figure.
Contrarily, the Makary paper has no new primary data. It is simply an extrapolation of existing data and the source is a paper by James in the Journal of Patient Safety in 2013. (Consider for a moment whether you may have any biases if your career depended upon publishing articles in the Journal of Patient Safety.) This paper also has no new primary data but relies on data from 4 published studies, two of them not peer-reviewed but Office of the Inspector General (OIG) reports. I will go through each of these in turn so we can see where these apocalyptic estimates come from.
OIG pilot study from 2008. This is a random sample of 278 Medicare beneficiaries hospitalized in 2 unspecified and nonrandom counties. All extrapolations are made from this small sample which has wide confidence intervals because of its small size (Appendix F, Table F1, page 33). A harm scale is provided on page 3 of the document where the worst category on the letter scale is "I" which is:
"An error occurred that may have contributed to or resulted in patient death." [Italics added.]