Generally speaking, "underlying" means it's there, causing an effect on other variables, but you may not be able see it directly, while "latent" usually means that it is present in an inactive form and may become active at some point.
However, in the domain of statistical analysis it seems like the two words may be closer in meaning:
Latent variable - "... not directly observed but rather inferred ... from other variables that are observed"
This seems like my definition of "underlying", and this is borne out by this page which lists types of variables:
http://www.indiana.edu/~educy520/sec5982/week_2/variable_types.pdf
"Latent variable - An underlying variable that cannot be observed"
So, it seems that underlying variables can be visible or not visible, and if they're not visible then we can call them a "latent variable".