What you are looking for nowadays goes by the name of the Rumin complex and is defined on any contact manifold. Moreover, there is a vast generalization of this that sometimes goes by the name of 'the variational bicomplex' and sometimes by the name 'characteristic cohomology'. Here is a brief description that is suited for the question you asked:
On $M = \mathbb{R}^3$ with coordinates $x,y_0,y_1$, consider the differential ideal $\mathcal{I}\subset\Omega^\ast(M)$ generated by the $1$-form $\omega = dy_0 - y_1\ dx$, i.e., $\mathcal{I}$ is the set of linear combinations of all multiples of $\omega$ and $d\omega$. Note that $\mathcal{I}$ is a homogeneous ideal and equals $\Omega^\ast(M)$ in degrees 2 and 3. Because $\mathcal{I}$ is closed under exterior derivative, it is a sub-complex of $\bigl(\Omega^\ast(M),d\bigr)$. Thus, there is a graded quotient complex, call it $\bigl(\mathcal{Q},\bar d\bigr)$, that vanishes in degrees above $1$. Note that $\mathcal{Q}^0 = \Omega^0(M)= C^\infty(M)$, since $\mathcal{I}$ vanishes in degree $0$.
Now, say that an element $\phi \in \mathcal{Q}^1$ is exact if $\phi = \bar d f$ for some $f\in \mathcal{Q}^0 = \Omega^0(M)= C^\infty(M)$. Unfortunately, unlike $\bigl(\Omega^\ast(M),d\bigr)$, the complex $\bigl(\mathcal{Q},\bar d\bigr)$ is not locally exact in positive degree. In fact, $\bar d \phi =0$ for all $\phi\in\mathcal{Q}^1$, even though $\bar d: \mathcal{Q}^0\to \mathcal{Q}^1$ is not onto.
Let me pause just a moment to explain how this fits into your question. Your equation $P(x)y'' + Q(x)y' +R(x)y = 0$ is encoded as the $1$-form $\phi = P(x) dy_1 + (Q(x)y_1 + R(x) y_0) dx$ (which represents the same class as the $1$-form $P(x) dy_1 + Q(x)dy_0 + R(x) y_0 dx$ in $\mathcal{Q}^1$), and you are asking when there is a function $f(x,y_0,y_1)$ such that $\phi = \bar d f$. (You should verify that $f = P(x) y_1 + (Q(x)-P'(x))y_0$ works when your equation is satisfied and that, otherwise, nothing does.)
Now, how can we test for exactness in this sense? This is where the Rumin complex (aka the variational bicomplex, etc.) comes in. It turns out that there is a way to embed the operator $\bar d:\mathcal{Q}^0\to\mathcal{Q}^1$ into a complex that provides a fine resolution of the constant sheaf, the same way that the exterior derivative does for the full complex of exterior differential forms.
What you do is this: Let $\mathcal{E}^2\subset\Omega^2(M)$ be the set of multiples of $\omega$ and let $\mathcal{E}^3=\Omega^3(M)$.
We now want to define a complex
$$
0\longrightarrow \mathcal{Q}^0
\buildrel{\bar d}\over\longrightarrow \mathcal{Q}^1
\buildrel{D}\over\longrightarrow \mathcal{E}^2
\buildrel{d}\over\longrightarrow \mathcal{E}^3
\longrightarrow 0.
$$
The map from $\mathcal{E}^2$ to $\mathcal{E}^3$ is the usual exterior derivative, so the only thing left to define is the map $D:\mathcal{Q}^1\to \mathcal{E}^2$. To do this, we first define a (first-order) operator $\delta: \mathcal{Q}^1\to\Omega^1(M)$, by requiring that $\delta(\phi)$ be a 1-form representing $\phi$ in the quotient complex and that $d\bigl(\delta\phi\bigr)$ lie in $\mathcal{E}^2$, i.e., that it be a multiple of $\omega$. (I'll let you write down the formula for $\delta$ in local coordinates.) Now, define $D\phi$ to be $d\bigl(\delta\phi\bigr)$. (Sounds almost trivial doesn't it?) The operator $D$ is easily verified to be second order and linear.
Now, it is not hard to verity that this complex is locally exact in positive degrees. (It also gives a fine resolution of the constant sheaf, so its cohomology on $M$ is canonically isomorphic to the deRham cohomology of $M$.) In particular, the local condition that $\phi\in\mathcal{Q}^1$ be exact is that $D\phi=0$.
You should verify (after you have defined $D$) that this reproduces your condition precisely in the linear case you asked about.
As pointed out by Pierre and Paul in comments, there are several standard ways to deal with this kind of issue. A good answer really depends what you're assuming you start from, and where you're trying to go to. The Jordan curve theorem and Stoke's theorem are both fairly sophisticated and difficult for beginners to grasp, so it's a bit hard to see how only analyzing embedded curves is streamlining anything, except perhaps helping with people's intuitive images---but even so, it may do more harm than good.
Perhaps it's worth pointing out that this statement is false in greater generality, for instance for closed subsets of $\mathbb R^3$. Here's an example in $\mathbb R^3$:
consider a sequence of ellipsoids that get increasingly
getting long and thin; to be specific, they can have axes of length $2^{-k}$, $ 2^{-k}$ and $2^k$. Stack them in $\mathbb R^3$ with short axes contained in the $z$-axis, so each one touches the next in a single point with long axes parallel to the $x$-axis, and let
$X$ be their union together with the $x$-axis.
Any simple closed curve in $X$ is contained in a single ellipsoid, since to go from one to the next it has to cross a single point, so every simple closed curve is contractible.
However, a closed curve in the $yz$-cross-section that goes down one side and back up the other sides is not contractible. The fundamental group is in fact rather large and crazy.
Anyway, here are some lines of reasoning that can overcome whatever hurdle needs to be ovrcome:
PL approximation, as suggested by Pierre: this is easy, the keyword is "simplicial approximation". I'll phrase it for maps of a circle to Euclidean space as in the question, even though essentially the same construction works in far greater generality. Given an open subset $U \subset \mathbb{R}^n$ and given a map $f: S^1 \to U$,
then by compactness $S^1$ has a finite cover by neighborhoods that are components of $f^{-1}$ of a ball. If $U_i$ is a minimal cover of this form, there is a point $x_i$ that is in $U_i$ but not in any other of elements of the cover; this gives a circular ordering to the $U_i$. There is a sequence of points $y_i \in U_i \cap U_{i+1}$, indices taken mod the number of elements of the cover. The line segment between $y_i$ and $y_{i+1}$ is contained in $U_i$, since balls are convex. (This generalizes readily to the statement that for any simplicial complex, there is a subdivision where the extension that is affine on each simplex has image contained in $U$. It also generalizes readily to the case that $U$ is an open subset of a PL or differentiable manifold).
Raising the dimension: if you take the graph of a map of $S^1$ into a space $X$, it is an embedding. If you're (needlessly) worried about integrating differential forms on non-embedded curves, pull the forms back to the graph, where the curve is embedded. If you want to map to a subset of Euclidean space with the same homotopy type, just embed the graph of the map
(a subset of $S^1 \times U$ into $\mathbb R^2 \times U$. (There's a very general technique to do this, if the domain is a manifold more complicated than $S^1$, even when it's just a topological manifold, using coordinate charts together with a partition of unity to embed the manifold in the product of its coordinate charts).
The actual issue for integration, using Stoke's theorem etc., is regularity --- to make it simple, restrict to rectifiable curves, and don't worry about embededness. Any continuous map into Euclidean space is easily made homotopic to a smooth curve, by convolving with a smooth bump function---the derivatives are computed by convolving with the variation of the bump, as you move from point to point.
Similarly, you can approximate any continuous map by a real-analytic function, if you convolve with a time $\epsilon$-solution of the heat equation (a Gaussian with very small variance, wrapped around the circle). This remains in $U$ if $\epsilon$ is small enough. A real analytic map either has finitely many double points, or is a covering space to its image; in either case you reduce simple connectivity to the case of simple curves.
Sard's theorem and transversality, as mentioned by Paul. Sard's theorem is nice and elegant and has many applications, including the statement that a generic smooth map of a curve into the plane is an immersion with finitely many self-intersection points, as is any generic smooth map of an $n$-manifold into a manifold of dimension $2n$. If the target dimension is greater than $2n$, then a generic smooth map is an embedding.
Best Answer
See http://en.wikipedia.org/wiki/De_Rham_cohomology and in particular De Rham's fundamental theorem. "Closed = exact" for a domain says the De Rham cohomology group is trivial in the appropriate degree; and the condition comes down to normal topological calculations.