A few notes on the development of thermodynamics, quantum mechanics, and statistical mechanics may cast light on their relationships. Of the three fields, thermodynamics was the first to develop. The conscious use of heat as a technologic artifact predates Homo Sapiens, the controlled use of fire having been initiated by Homo erectus or Australopithecus robustus ca. 1-1.5 megayears BPE. An understanding of the nature of heat -- whether heat is a material substance or something more subtle -- is slightly more recent. (Brush has carefully examined the history of man's knowledge of heat, from its earliest beginnings through the end of the 19th century.) Rumford suggested that heat could be created from work, but his results were not definitive. In 1824, Sadi Carnot set down a relation between heat and work which is now enshrined as the Second Law of Thermodynamics. The minor detail that Carnot initially believed that heat is conserved, and can neither be created nor destroyed, has little effect on the validity of the remainder of his results. It remained for Joule, Meyer, and others to propose and establish the First Law of Thermodynamics, and the interconvertibility of heat and work. Joule's experimental data were for a time ignored, in no small part because the error bars in his data were so huge, even though Joule (honestly) claimed an experimental precision far better than that which any of his contemporaries could obtain. The ideas of Joule and Carnot were at first seen as contradictory; their resolution occupied the attentions of several great scientists, in particular Clausius, who set down the principles:
Die Energie der Welt ist konstant.
Die Entropie der Welt strebt einem Maximum zu.
which form the basis of engineering thermodynamics. The theoretical application of the laws of thermodynamics to problems of chemical interest is due to the immortal J. W. Gibbs, who in a single paper deduced virtually the entirety of theoretical chemical thermodynamics. Since 1878, work on chemical thermodynamics has consisted in large part in the detailed and numerical application of Gibbs' a priori results.
The history of quantum mechanics is treated in detail (some details even being correct) in many introductory texts. A historical perspective oriented toward molecular and chemical (as opposed to nuclear and subnuclear) quantum mechanics, albeit one tinged with personal reminiscences, is to be found in Slater's Scientific Biography . Direct ties between statistical and quantum mechanics are often said to have appeared in Planck's 1900 treatment of black body radiation. We'll treat this issue in Lecture 9, following Kuhn's  historiographic treatment of Planck's writings.
What, then, is the historical position of statistical mechanics? Statistical mechanics arose from classical mechanics and the kinetic theory of gases. Newton set down laws of motion which appear to govern both the wheel of the planets across the constellations and also the motion of smaller particles. The application of Newtonian mechanics to the atoms of a gas, as attempted in the Nineteenth Century, was subject to two major obstacles, one practical and one fundamental:
First, Newton's laws are differential equations. To integrate them, one needs to know a set of initial conditions or boundary equations, such as the positions and momenta of all the particles in the system at some initial time. For Nineteenth Century science, determining the initial conditions for the atoms in as little as a cubic inch of gas was impossible. Even if the initial conditions were known, integrating the resultant differential equations would in the Nineteenth Century have been impractical.
Second, before applying classical mechanics to an atomic system, many people would feel constrained to admit a belief in the existence of atoms, and to some picture (the static theory of gases is an early erroneous example) of their nature. Readers familiar with Dalton's concept of equivalent weight, or with van't Hoff and LaBel's interpretation of organic chemistry in terms of the tetrahedral carbon atom, may find it unlikely that a need to believe in atoms could have been an obstacle to late 19th-century scientists. However, prior to 1905 the bulk of European physical chemists apparently did not believe in atoms. Weighted by the baneful and antiscientific influence of positivistic philosophy, they (e. g., Nernst, Ostwald) believed that the atom was at best a sometimes-convenient hypothesis, but that only energies could be fundamental. This opposition largely collapsed after Einstein's 1905  explanation of Brownian motion, since in 1905 it was universally presumed that Brownian motion could not be explained by a continuum theory of matter. (Modern continuum hydrodynamics does explain Brownian motion, in terms of stress fluctuations in the solvent, contrary to the belief that only an atomic model yields Brownian motion. The acceptance of the atomic hypothesis on the basis of the Einstein diffusion model is thus an example of mutually cancelling errors. Certainly, earlier experimental work on the electron charge and on radioactivity ought to have been recognized as support for the atomic hypothesis.)
Maxwell, Boltzmann, and others worked extensively on the kinetic theory of gases, finding that the theory successfully predicted unexpected results, such as the independence of a gas's viscosity from that gas's density. The use of atomic theory by early kinetic theorists led to vitriolic exchanges between the kinetic theorists and their opponents, notably the energeticists, who believed that only energy was fundamental. Early kinetic theorists solved the initial condition problem -- their lack of knowledge of exact coordinates for every atom -- by introducing statistical assumptions into the theory. After all, the thermodynamic properties of bulk matter are virtually the same in different samples of the same substance. Entirely different sets of initial conditions give rise to practically the same macroscopic behavior, so a full microscopic description of a block of matter must be unnecessary for a calculation of thermodynamic properties. Rather than positing specific initial conditions, the statistical odds of finding particular initial conditions were estimated.
Statistical mechanics in its modern form was set down by J. Willard Gibbs in the single volume Elementary Principles in Statistical Mechanics. This is, of course the same Gibbs who twenty years before had deduced chemical thermodynamics. Gibbs is also largely responsible for the use of vectors and vector notation in the physical sciences. For these three contributions, the Statistical Mechanics having been completed during his sixty-second year, Gibbs may reasonably be esteemed one of the premier intellects of human history, to be ranked with Aristotle and Newton.
Gibbs treated a system of point atoms, deliberately evading the question of its correspondence with reality. He flatly admitted that his treatment was not adequate in its treatment of systems having infinitely many degrees of freedom, such as radiant heat (the black body problem). A systematic resolution of difficulties posed by systems having infinitely many degrees of freedom was not available until quantum theory was developed. The development of statistical mechanics proved far more demanding than the application of thermodynamics. Only two decades separate Clausius' statement of the two laws of thermodynamics from their full flower in Gibbs' hands . Nearly three-quarters of a century distance Gibbs' statement of statistical mechanics  from the first quantitative treatment of the equilibrium properties of a simple liquid -- liquid Argon. The use of statistical mechanics in non-equilibrium problems lags even farther. A historical treatment of Twentieth Century statistical mechanics is not yet available, though it appears not entirely implausible that the largest single role will be seen to have been played by J. G. Kirkwood and his students.