I don't know if it is necessary to add yet another answer, but this theme is close to my heart. I'm not a historian, and I would be happy if someone corrects me here, but I have the impression that the idea of understanding a differential in terms of its periods, which would go back to Riemann at least, would have been ana historical antecedent to de Rham's theorem. In other words, I don't think the theorem came out of a vacuum.
To explain what I mean by periods, suppose that $X$ is a compact Riemann surface of genus $g$. Then $H_1(X,\mathbb{Z})=\mathbb{Z}^{2g}$, with a basicbasis of loops $\gamma_i$ constructed in the usual way. De Rham's theorem gives an isomorphism of the first de Rham space $H^1(X,\mathbb{C})\cong \mathbb{C}^{2g}$ by identifying a $1$-form $\alpha$ with its period vector $(\int_{\gamma_i}\alpha)$. Of course, the 19th century people would have been more interested in the case where $\alpha$ is holomorphic. In this case, the space of holomorphic forms injects into $H^1(X,\mathbb{C})$ (Proof: $\alpha=df$ implies that $f$ is holomorphic and therefore constant). This is why they could talk about this without explicitly defining cohomology first.