You don't say if you had anything to eat on the ride or anything to drink other than water. (You did have water, I hope!) Obviously as you increase your time in the saddle, you have to fuel with more than just water. Since you are a new rider, a former smoker (congrats!), were riding in hills, and didn't really plan your ride out, it must have taken at least two hours, if not three. Rides of that length really do call for some nutrition during the ride, or at the very least, a sports beverage during the ride, not just water. Water is normally fine for rides lasting an hour or less, but above that, you have to replace the glycogen that is being burned as you ride.

A hilly 25-miler when you've only been riding 4-6 miles at a time is a huge increase and would be hard for anyone, so don't sweat it! We all started with short rides once too. Be patient with yourself, and welcome to the wonderful world of cycling!