Which is more important when applying to grad school (particularly top grad schools): Research or Letters?
Short answer: In practice, letters are more important.

Long answer: Doing great research is great, but if I'm on an admissions committee, how do I know your research is great? I can read your paper, but unless it's close to my area of expertise, it can be hard or at least time-consuming to determine its quality. I probably have too many applicants who wrote a paper to read everyone's paper in detail (depending on how common undergraduate authorship is in my field). And even if I'm convinced the paper is great, how do I know what your contribution to the paper was? (In the fields I'm familiar with, it's very rare for undergrads to author solo papers.) On the other hand, if I have a letter from a faculty member whose word I trust saying that this paper is great and you did most of the hard work (or even that he/she is very impressed with your potential), that's much more useful.