Suppose $X\subset k^n$ is a quasi-affine variety and $p\in X$ is a point in $X$. Denote by $m_p\subset O_p$ the maximal ideal of the local coordinate ring $O_p$ of $p$. Finally, assume the Zariski tangent space at that point is one-dimensional. Why is $m_p$ a principal ideal? Is there a general result towards connecting the dimension of a variety to the dimension of its Zariski tangent space to some point?
For a point $p$ on a variety (or scheme) $X$, the Zariski cotangent space at $p$ is the $k$-vector space $m_p/m_p^2$, where $k = O_p/m_p$ is the residue field at $p$. The Zariski tangent space $T_pX$ is then the $k$-dual of the Zariski cotangent space.
Now if one assumes that $T_pX$ is one-dimensional (equivalently, $\dim_k m_p/m_p^2 = 1$, since these are finite-dimensional), then by Nakayama's lemma, $m_p \subseteq O_p$ is generated by one element, i.e. is a principal ideal in $O_p$.
In general, $\dim_k T_pX$ is at least the codimension of $p$ in $X$, i.e. $\dim_k T_pX \ge \dim O_p$, with equality iff $p$ is a nonsingular point of $X$, i.e. $O_p$ is a regular local ring. Notice that if $X$ is an (irreducible) affine variety over a field and $p$ is a closed point, then the codimension of $p$ is just $\dim X$.