The relationship between horsepower, torque and speed is a fairly complex one. Like many complex questions, this one boils down to one fairly straightforward answer, followed by a lot of "buts." Ultimately, the question of whether you need more horsepower or torque comes down, not to one of the engine, but of the vehicle wrapped around it.
The Nature of Horsepower and Torque

Horsepower is the amount of work an engine can do over time; torque is the amount of force that engine exerts with no respect to time. Think of it like this: If you have to load 2,000 pounds worth of bags of cement in an hour, that's the amount of work you have to do: 2,000 pounds, from the ground to the truck bed, in an hour. A big, strong person who can exert a lot of force  torque  might prefer to lift 20 100pound bags of concrete. A smaller person might not be able to lift 100pound bags, so he'll opt for 100 20pound bags. He'll have to load concrete five times faster to load 2,000 pounds in an hour, because he exerts less torque per bag. But if he does, he'll have performed exactly the some amount of work. Engines are the same. Pounds of concrete per hour equals horsepower, pounds of concrete per bag equals torque, and the number of bags moved in an hour equals engine rpm.
Horsepower and Speed

How fast a car goes over a certain distance  typically, through the quartermile  and its top speed are directly relative to the amount of force resisting it, and the amount of work the engine can do. Long story short, trap speed through the quartermile and top speed over a given distance are directly proportionate to horsepower. More horsepower equals more speed. If you know a vehicle's weight and its horsepower, you can mathematically figure out almost exactly how fast it will be going through the finish line at the quartermile. The formula is: Horsepower = weight in pounds X (speed in mph/234) cubed. If a vehicle weighs 2,000 pounds, and it's going 150 mph through the traps, it has 527 horsepower. More horsepower makes for a higher trap speed; torque has nothing to do with it. If you're looking at top speed, aerodynamic drag and vehicle frontal area  size  are the dominant factors. If you also know the vehicle's drag coefficient, frontal area and horsepower, you can calculate its top speed.
May the Force Be With You

So, horsepower is the dominant factor when you're talking about speed over a given distance, either a quartermile dragstrip or on a topspeed course. But all of that's assuming that the engine is actually running at its peak horsepower rpm. Engines produce different amounts of horsepower at different rpms; Horsepower = torque X rpm / 5,252, so given the same amount of torque, horsepower increases with engine rpm. Say your engine produces its peak 500 horsepower at 6,000 rpm; if the cars is geared so that you stay at 6,000 rpm through the quartermile, or hit 6,000 rpm during your topspeed run, then you'll hit your theoretical best trap speed or top speed. Now, say the engine only produces 400 horsepower at 4,500 rpm. If you shortshift at 4,500 through the quartermile, and the car is geared so that you're doing 4,500 rpm through the traps, then your trap speed drops. The same is true of top speed; if your car is geared so that top speed occurs at 4,500 rpm, then over a given distance you're only going to get 400 horsepower's worth of top speed.
Time and Distance

Going faster takes increasing amounts of horsepower. Put another way, the faster you go, the harder it is to go faster. If you're not putting enough power to the ground at a certain rpm to get that extra 1 mph, you're not going to go any faster before you run out of room. You need more torque to overcome that difference in power requirement. You can get that torque either by using steeper gears, or increasing engine torque. So, to put it simply, horsepower gives you a higher speed, and torque allows you to get to that top speed more quickly. Horsepower allows you to go faster over a given distance, and torque allows you to go faster over a given time.
Torque Wins Races

If the world were one endlessly straight road, horsepower would always win races. In the real world, though, a car that can get to 200 mph in three seconds will beat one that takes six seconds to hit the same speed. Cars with more torque have a huge advantage when accelerating out of corners, because they can get up to speed faster. Cars with more torque also have an advantage on the dragstrip, because they don't require perfect gearing to exploit their horsepower potential. If you're comparing two dedicated race cars on a straight stretch of road, both of which have perfectly ideal gearing, then the car with more torque will tend to win more races, just because the margin of error is higher. Peaky, highstrung engines just aren't as forgiving of minor mistakes. If you're building a car for straightline racing, build for horsepower, but make sure the gearing is perfect. If you're building it for roadracing, a broader torque curve and alwayson power at every rpm trumps highrpm horsepower.