I am really concerned when people talk about "canceling" parts of derivatives. It works, of course, but you should keep in mind that this is just a 'mnemonic'. What really is happening is that, going back to before the limit of the "difference quotient", where you really do have fractions, do the cancelling there, then taking the limit. You have to be careful that limits "respect" the fractions.
From [itex]T= (1/2)mv^2[/itex] we have [itex]dT/dx= (1/2)m d(v^2)/dx[/itex] (assuming that m is constant, of course) [itex]= m v dv/dx[/itex]. Now, a slightly more "rigorous" argument would be that since x is itself a function of t, [itex]dv/dt= (dv/dx)(dx/dt)[/itex] (the chain rule). But, of course, [itex]dx/dt= v[/itex] so that says that [itex]dv/dt= (dv/dx)(dx/dt)= (dv/dx)v[/itex] and so [itex]dv/dx= (dv/dt)/v[/itex]. Putting that into the above, [itex]dT/dx= m v (dv/dt/v)= m dv/dt= ma[/itex]