It depends on how hard is your keyword. But generally the most valuable are links from sites with high pagerank (>4). On the other hand you could have tons of PR=7 links but rank low in search engines because of spamming search engines, so you are right content optimization is very important as well.
But for example a directory has no content, so how can one make it rank highly for a certain keyword??
What truly matter are the links and the anchor text in them. Type "miserable failure" in Google and you will se that this is true. The keywords should also appear at least once in the content, preferably in the headline and in the meta tags. Also the code should be validated so do the search spiders don't experience any hiccups. Hope this helps. Regards, George