Let $y=e^{t^2/2}$, so $\frac{dy}{dt}=yt$. Then $\frac{\partial^2y}{\partial t\partial y}=t$, although this would contradict $\frac{\partial^2y}{\partial y\partial t}=\frac{\partial 1}{\partial t}=0$ (and also the actual value $t+\frac1t$)
Where did I go wrong and what's the proper way to take the partial derivative with respect to $y$?
Note that $$y'=y(t)t$$
thus
$$\frac{\partial y'}{\partial y}=t+y\frac{d t}{d y}=t+\frac1t$$
I'm not completely sure that take this kind of partial derivative has a meaning but note that
$$\frac{\partial^2y}{\partial t\partial y}=\frac{\partial}{\partial t}\frac{\partial y}{\partial y}=\frac{\partial}{\partial t}1=0$$
$$\frac{\partial^2y}{\partial t\partial y}=\frac{\partial}{\partial y}\frac{\partial y}{\partial t}=\frac{\partial}{\partial y}te^{t^2/2}=0$$
Note also that
$$\frac{\partial y'(y,t)}{\partial y}=\frac{\partial}{\partial y}\frac{dy(t)}{dt}\neq\frac{\partial^2y(t)}{\partial t\partial y}=\frac{\partial}{\partial t}\frac{\partial y(t)}{\partial y}$$
since the LHS is a first order partial derivative on $y'(y,t)$ while the RHS is a second order partial derivative on $y(t)$.