Consider the surface $z = f(x,y)$. What is the 3d tangent vector at $(x_0,y_0, f(x_0, y_0))$ that has $(x,y)$ components $a \mathbf{i} + b \mathbf{j}$?
We begin by sketching the tangent vector of a general surface from two views: in 3d perspective and along a cross section in the direction of $a \mathbf{i} + b \mathbf{j}$.
We need to find the value of $c$, such that the blue vector is tangent to the red curve above.
The 'slope' of the vector $a \mathbf{i} + b\mathbf{j} + c\mathbf{k}$ in that same direction is $$\frac{c}{| a \mathbf{i} + b \mathbf{j}|}$$
Equating and multiplying by $| a\bfi + b \bfj|$, we get $$ \nabla f(x_0, y_0) \cdot (a \mathbf{i} + b\mathbf{j}) = c.$$
The tangent vector we seek is thus $$ a \mathbf{i} + b \mathbf{j} + \left( \nabla f(x_0, y_0) \cdot (a \mathbf{i} + b \mathbf{j} ) \right ) \ \mathbf{k}.$$