As usual, I’m late to the party, so all the good answers have been taken. So, I’ll just throw this out there:
“Dinosaur” is a pretty expansive group, comprising over 1,000 genera, not including their feathered descendants. They existed, as a group, for a period of about 160 million years. During that time, species arose, thrived, and died out. At any given time, there were, perhaps, representatives from about 100 genera walking around.
Humans, on the other hand, are but a single species (perhaps two or three, depending on who you ask in human paleontological circles). They have existed for, perhaps, 5-10 million years – little different than any other vertebrate species, including individual dinosaur species.
As such, it is rather unfair to compare “humans” to “dinosaurs”; indeed, it’s probably not possible to do so in any meaningful way.
Now then: intelligence, like many other things in nature, is something of a continuum, between “pure instinct” and “ability to build jet aircraft”. Within any group, be it mammal, dinosaur, or fish, there are likely to be representatives from all over that continuum. Predators, in general, are “smarter” than their prey, regardless of what group each belong to (for the simple reason that it takes more problem-solving ability to catch prey than to eat leaves or grass). So, it’s also a bit unfair to refer to dinosaurs as a whole as “stupid”; certainly, some of the large herbivores were not likely to be anything close to a Nobel candidate, but some of the smaller predators (in particular, Troodon, near the end of the Cretaceous) had larger brain/body mass ratios than one might expect for them being glorified reptiles. So,there were,indeed, dinosaurs which were getting “brainier”, at least.
However, one should never make the mistake of assuming that one can determine something as vague and conceptual as “intelligence” from the fossil record. We don’t know, nor do we have any way of knowing, how smart any given dinosaur was. Some appear to have exhibited complex social behavior, such as the ability to hunt in packs (e.g., Deinonychus). Others appear to have had complex nesting behavior and parenting behavior – traits not generally attributed to "typical " reptiles.
All we do know is that humans are relatively unique, simply by virtue of being in the right place at the right time. Our ancestors paved the way for our smarts; we simply took the next step. However, if the clock were turned back, even just to the end of the Cretaceous, there are no guarantees that things would turn out the same. It should be noted that after the K-T extinction, mammals did not immediately take over in a number of locales: birds (which, remember, where still, technically, dinosaurs) did. Think Dinornis. So, mammalian superiority isn’t all it’s cracked up to be.