Answering your last comment...It is a well-known theorem that a bounded function on a finite interval $[a,b]$ is Riemann integrable if and only if the set of discontinuities of $f$ is a set of measure zero; of course, if $f$ has a finite number of discontinuities, then this set certainly has measure zero and so $f$ is Riemann integrable. It is another well-known fact that Riemann integrable functions which differ on sets of measure zero have equal integrals. The way you have defined $g$ makes it Riemann integrable (since $g$ is continuous), and by assumption $h$ is Riemann integrable on $[a,b]$. Hence, $gh$ and $fh$ are both Riemann integrable (another well-known fact), so both integrals exist, and since $fh=gh$ almost everywhere (you can define $fh$ however you please at the points of discontinuity), their integrals are equal (you can look up any of these 'well-known' facts by a simple Google search or reference text on basic analysis; some of the special cases, e.g. reducing measure zero sets to finite sets are easier and straight-forward to prove with standard partition/epsilon regularization arguments).
Your reasoning isn't very well refined either. I think you're missing the essential point that integration (Riemann, Lebesgue, or otherwise) "doesn't care" about how a function is defined on sets of measure zero; it could be $+\infty$, $0$, $\pi$, $e$, $2.399$, whatever at such points and the integral will "ignore" these modifications. That heuristic is helpful to keep in mind in integration theory. Another one is that integration is a smoothing process that accepts much rougher functions and outputs even smoother (or just as smooth) of functions, as where differentiation is a "roughing-up" process that accepts only smooth functions and outputs (in general) rougher functions (or at the very least, just as smooth). Part of this ladder heuristic is encoded in the fundamental theorem of calculus (both parts) which is often overlooked by first-learners.