It is proved that the 3-part of the class number of a quadratic field $\mathbb{Q}(\sqrt{D})$ is $O(|D|^{55/112 + \ep})$ in general and $O(|D|^{5/12+\ep})$ if $|D|$ has a divisor of size $|D|^{5/6}$. These bounds follow as results of nontrivial estimates for the number of solutions to the congruence $x^a \,{\con}\, y^b$ modulo $q$ in the ranges $x \,{\leqslant}\,X$ and $y\,{\leqslant}\, Y$, where $a,b$ are nonzero integers and $q$ is a square-free positive integer. Furthermore, it is shown that the number of elliptic curves over $\Q$ with conductor $N$ is $O(N^{55/112 + \ep})$ in general and $O(N^{5/12 + \ep})$ if $N$ has a divisor of size $N^{5/6}$. These results are the first improvements to the trivial bound $O(|D|^{1/2 + \ep})$ and the resulting bound $O(N^{1/2 + \ep})$ for the 3-part and the number of elliptic curves, respectively.