I think the solution is simply to adapt. Some questions are pretty much read once, by a small handful of people, then it drops off the face of the Earth and is never visited again. In those cases, not much rep is at stake, and it generally goes to the first acceptable answer. It doesn't matter if you write a better answer, if by then the question is answered and no one will ever read the thread again.
Others are continually bumped, as new answers are added, people comment, and the question gets edited. Those tend to attract much more rep, and in those cases, it also tends to balance itself towards the good answers. It doesn't matter that someone else posted first, because people keep coming back to the thread, so once your superior answer goes up, everyone will see it, and you'll get plenty of rep.
Which means it's not really a huge deal IMO. Sometimes you get fewer upvotes than your answer warrants, but that's usually only in the cases where no answer in the thread gets more than 3-4.
In the questions where some answers get 20+, later answers have plenty of time to get caught up.
Of course, the type of question also influences this. Questions that are tricky to answer, but which interest a lot of people are great. (I had one answer jump to 74 upvotes within a few hours the other day. Not because it was a stunningly good answer, but because it did the job, and a lot of people were interested in the subject, and kept commenting and keeping the question (and my answer) visible.
And sometimes, I write detailed answers and get nothing for my trouble because by then, no one else is going to read the question again.
That's just life. :)
As for the JQuery question you mentioned, it's worth noticing that it is
- asking about a popular technology (so more people will read it, answer it and up/downvote it, and
- is easily answered. It's hard to give good or bad answers to it. It's not a question where people are inclined to read down past the first answer to see if there are any subtleties they'd miss otherwise. The simpler the answer, the more the "quick" answer is favored. Which means it's usually more rewarding (in more ways than one) to answer the more complex ones.