If you assume that
$$ V_t = V(t,S_t;\theta) = \Bbb{E}^\Bbb{Q} \left[ e^{-\int_t^T r(s) ds} V_T \mid \mathcal{F}_t \right] $$
with $V_T = h(S_T;\theta), \Bbb{Q}-\text{a.s.}$ along with
$$ dS_t/S_t = r(t) dt + \sigma W_t^\Bbb{Q} $$
then this equivalently means that
$$ \frac{V_t}{B_t} = \Bbb{E}^\Bbb{Q} \left[ \frac{V_T}{B_T} \mid \mathcal{F}_t \right] \tag{1} $$
where we have defined $B_t = e^{\int_0^t r(s) ds}$ (let's assume $r(t)$ is deterministic in what follows without loss of generality), which is the mathematical representation of the fact that $V_t/B_t$ is a $\Bbb{Q}$-martingale.
Hence by the martingale representation theorem we should have that (pure diffusion assumed)
\begin{align}
d\left(\frac{V_t}{B_t}\right) = f(.) dW_t^\Bbb{Q}
\end{align}
for some well-behaved function $f$.
Computing the differential on the LHS using the information at hand and Itô calculus leads to ($B_t$ has finite variation)
\begin{align}
d\left(\frac{V_t}{B_t}\right) &= \frac{dV_t}{B_t} - \frac{V_t}{B_t^2}dB_t + 0 \,d\langle V \rangle_t + 2 \frac{V_t}{B_t^3} \underbrace{d\langle B \rangle_t}_{0} - \frac{1}{B_t^2} \underbrace{d\langle V, B \rangle_t}_{0} \\
&= \frac{1}{B_t} \left( dV_t - V_t r(t) dt \right) \\
&= \frac{1}{B_t} \left( \frac{\partial V}{\partial t} dt + \frac{\partial V}{\partial S} dS_t + \frac{1}{2} \frac{\partial^2 V}{\partial S^2} d\langle S \rangle_t - V r(t) dt \right) \\
&= \frac{1}{B_t} \left( \frac{\partial V}{\partial t} + \frac{\partial V}{\partial S} r(t) S + \frac{1}{2} \frac{\partial^2 V}{\partial S^2} \sigma^2 S^2 - r(t) V \right) dt + \frac{1}{B_t} \frac{\partial V}{\partial S} \sigma S dW_t^\Bbb{Q}
\end{align}
hence requiring
$$ \frac{\partial V}{\partial t}(t,S) + \frac{\partial V}{\partial S}(t,S) r(t) S + \frac{1}{2} \frac{\partial^2 V}{\partial S^2}(t,S) \sigma^2 S^2 - r(t) V = 0 $$
with $V(T,S_T) = h(S_T;\theta)$, which is precisely the pricing PDE.