The problem with science fiction isn't that it's dead. To be fair to the genre, it's never actually died, but it has been overshadowed to varying degrees in history. Even in its supposed "Golden Age" science fiction was not exactly as popular people seem to remember. Yes, it was popular, but science fiction never had the popularity of mainstream pop-fiction. That's not to say it was irrelevant or that no science fiction books sold well enough to make it to the bestseller's list; quite a few actually did, but in comparison to traditionally larger genres (romance and quasi-mysteries), it really didn't make the crossover into market dominance at any point in its multi-century lifespan.
Fantasy, on the other hand, has, and not because the genre is necessarily better (and neither is it worse). Fantasy is doing well because it got lucky. Now, to be fair to fantasy, it has always done rather well ever since Tolkien became a persistent model for other fantasy writers. As a genre, fantasy had a lot of uphill battles to fight to get to a point where it had a secure market, but once it got there it never let it go. Now, however, fantasy has exploded. Some have said that fantasy is experiencing a "Golden Age" of its own--and I would have to agree. Why?
Well, as unpredictable as the market often is in regards to what will be the hot item of the year, I would say that fantasy simply got lucky. The publishers had no way of knowing that urban fantasy would plow through the roof like it did, or that other forms of fantasy (more traditional forms, if you will, and even the exceedingly non-traditional--literary, ultra-weird, etc.) would grow moderately over the last couple decades. It just happened.
Now, if I were to argue for a reason, I would say that the last eight years have had a lot to do with the rise of fantasy. Publisher Weekly almost acknowledged as much in the last year when the recession hit and sales of escapist titles (science fiction and fantasy) actually rose (it was temporary in the sense that, while people were going to SF/F for a presumed escape from the present, the downturn of the economy eventually led to an almost universal drop in sales in almost all markets, some of which have yet to fully recover). The reality seems to be that when the proverbial crap hits the fan, readers flock to literature that is less likely to make matters worse. They want heroes and adventures, of a sort. I don't know if this is true for everyone, but sales seem to reflect that. I am unsure how urban fantasy fits into this assessment--UF tends to be somewhat dark in nature. Either we have to accept that people are somewhat darker at heart than we ever anticipated, or urban fantasy offers a bit of harmless, well, fantasy.
I don't know how long fantasy's "Golden Age" will last. As with all booms in literature, there are limits, and I suspect that urban fantasy, which seems to be the genre largely pulling fantasy up out of the pool, will eventually wear out its welcome--fantasy, as a whole, will not. For now, we can sleep soundly knowing that science fiction isn't dead and fantasy is doing quite well. That's good news.