Ah is a measure of charge. Wh is a measure of energy. If you can assume that the voltage is constant, then the two are directly proportional to each other.
The same issues come up with amps and watts, not to surprisingly. Amps are a measure of current, and watts of power; but sometimes amps are used as a sort of stand-in for power, under the assumption that the voltage is constant (and hence they are proportional).
A somewhat similar thing also sometimes comes up when talking about distances. If someone asks me how far it is to Albany, NY, I'd probably say it's about a three-hour drive from my house. Of course, hours are not really a measure of distance, and that answer is nonsense technically speaking. However, when the speed can be assumed to be constant, they're directly proportional. In the case of getting to Albany, the speed is definitely not constant, but it's at least fairly consistent most of the time. (The actual distance is about 150 miles, and my average speed ends up being about 50 mph.)