In the case of the labor of an employee or a contractor, the person you're working for. Value is what someone is willing to pay, or trade, or work, for something.
For example, diamonds aren't valuable because they are rare or hard to make (anymore), they're valuable because people are willing to pay large amounts of money to signal to loved ones how loved they are, to signal how rich someone is because they can spend a large amount of money on a rock, etc.
This doesn't mean that price is equal to value. How about the value of the diary of your hypothetical dead grandmother? It may be "priceless" to you while it's in your possession, but there is some absurd amount of money that someone could offer that would make you part with it ($10,000, $100,000, $1,000,000,000, etc.). This isn't its market value, however, because the price some person (a historian perhaps) would be willing to pay for it is likely quite a bit less. And there is certainly a price you'd be willing to recover it.
Take for example family photographs, I recently had a coworker bring in a computer with a dead hard drive. This hard drive had thousands of family photographs that weren't backed up. I made sure that the hard drive was really dead and not just mostly dead and let them know that taking it to a lab was their last option. The cost would likely be between $1000-$4000 and they wouldn't get a guarantee that they'd get anything. They thanked me for my time and decided not to attempt to recover the images.
To make the problem even more interesting let's look at a commons. How valuable is Wikipedia to you? Assuming that you haven't donated to it, nothing. This doesn't mean that it isn't useful to you, or that it doesn't benefit humanity as a whole, or that it is necessarily a waste of everyone's time. It's valuable to the people that run it, it's valuable to the people that donate to it, but everyone else lacks skin in the game.
You might try to calculate its value by summing the labor of all the contributors of the site (http://en.wikipedia.org/wiki/Labor_theory_of_value), but this would make it more valuable if people made it less efficient to add content to the site (perhaps requiring that people mail their edits in triplicate in approved forms obtained from the local post office on a tuesday morning).
The reason why the tragedy of the commons is a problem is because commons are frequently more valuable to everyone than they are to someone. You can't hope to solve these problems without understanding what value is.
>(3) writing effective advertisements that persuade people to by my product rather than a rival's which is actually slightly better for their needs (hugely valuable to me, negative net value to the world)
To defend people in marketing, somebody has to let people know about products and services.
> If you care about doing something that's valuable overall then being well paid is no guarantee whatsoever of that.
Right. Many people value work that benefits society as a whole, or work that satisfies their own curiosity, or work that helps their religion or political beliefs, or work that has high status in the society they live in. Due to this millions of people forego higher wages.
None of this makes people getting paid lots of money better people than people getting paid less money.