This meta-study from Germany by Lenz, Richter and Mühlhauser looks at the correlation between weight and death due to various conditions.
As is usual for these studies (the NHANES data from the USA, and a more recent Canadian study, for example), the result was that - on average - being "overweight" was correlated with fewer all-cause deaths than "normal weight" (though, like NHANES, not statistically significantly). Some individual causes were more common in lighter people, some were more common in heavier people. "obese" was not statistically significantly different from "normal weight" in some cases, and the effect was otherwise minor.
This quote from page 646 (the PDF is an extract and translation from a journal, so page 6 of the PDF file) is quite telling:
In addition, the medical literature primarily analyzes those diseases for which an effect through overweight or obesity is plausible to exist. Thus, there is a suspected investigational and publication bias for diseases that appear to be favored by overweight or obesity.
This assumption is supported by the results of the mortality analyses: all cause mortality is not increased in overweight individuals. This parameter is made up of disease-specific mortality risks for each disease. Many of the diseases analyzed here yield elevated risks. Accordingly, there must also be still unidentified diseases with a reduced risk.
In other words, people are looking, in great detail and with lots of funding, for diseases that might kill fat people, especially ones where they can think of a plausible reason that it might. Far fewer people are looking for diseases that might kill thin people. It's therefore not surprising that being fat appears more dangerous, but actually, it's just that we don't know what does (statistically) kill thin people.
There's a similar effect, which the paper also discusses, regarding non-fatal illnesses that more often affect fat people and more often affect thin people: again, illnesses primarily affecting fat people are well-documented and researched. No-one's entirely sure what illnesses thin people get, which will not help you if you're both thin and ill.
The paper doesn't discuss correlation versus causation for any of the diseases. To some extent in this context it doesn't matter whether the disease affects you because of your weight, or whether the disease and the weight are both connected to some underlying factor: either way, diseases primarily affecting thin people are underresearched - which leads to the assumption of thin=healthy, fat=unhealthy, and a whole mess of policies and public messages based on this clearly wrong assumption.
From page 647 (page 7 of the PDF)
There are also confounding factors the effect of which are plausible, but cannot be quantified. In the risk of developing diabetes these include undiagnosed cases that are more frequently discovered in overweight and obese persons (e44). It is suspected that greater attention is paid to diabetes in these groups.
In other words, diabetes may be detected more in heavier people because previous research has suggested that heavier people are more likely to have diabetes, which means that doctors are more likely to check fat people for diabetes, which means it's more likely to be discovered, which means future research can note the correlation.
Nice to know that our "biggest health challenge" may be based entirely on some extremely badly-done statistics and (unintentionally) selective research.