The British Navy during the 18th and 19th centuries was a meritocracy insofar as it rewarded those who distinguished themselves in service with advancement. This was different to the British Army at the time, where rank was more or less bought and where title made a significant difference to one's prospects.
This is an example of just how effective a meritocracy could be; by comparison (at the time), the senior naval officers were far more adept than many of their army counterparts, but were relatively less well known in aristocratic circles. With the exception of the Duke of Wellington, I can't think of a single army flag officer that carried the reputation of competence that Lord Nelson did (the son of a reverend).
That said; there's a reason that a meritocracy worked in that environment. Ship's crews HAD to work as a tightly knit team in order to function, let alone prevail. That meant that the officers who had the respect of their crews were the ones that fared better. Despite this, attrition was horrific during war, hence the need to press competent sailors into service (a little understood foray into conscription by the British at the time). This meant plenty of room for advancement in the ranks for competent officers. Finally, the goals were quite clear and a ship operated as a microcosm of a community with a common goal.
This last point is perhaps the most important. When everyone in your community shares a goal, then 'merit' is easy to assess. What makes one meritorious is known by consensus and everyone can agree on the decision, more or less.
In a more general community, the concept of 'merit' will mean different things to almost everyone. One of the reasons that democracies struggle with reform is that what is in the interest of the individual is almost never in the interest of the group, in this case the state. Therefore, to get to power you have to promise action on what the largest number of individuals want, not what is best for the state. This in turn makes it difficult to enact what you went into politics to do, because you first have to convince the population that it's necessary.
Ultimately, this becomes a fatal flaw in a society even slightly more fragmented than an old naval tall ship. How do you define merit? Many have tried. Read the Republic by Plato and you see a community where merit and advancement are assessed on one's willingness and ability to defend the state with one's life. George Orwell (in 1984) described the Inner Party as the true fanatics; those with an obsession about the rightness of their methods and the willingness to crush all opposition, both foreign and domestic.
In both cases, little is made of academic excellence, a solid understanding of economics or social policy, legal or scientific training, or even the ability to reason. This last one in particular is actually discouraged if it gets in the way of preservation of the state in its current form. Despite this, these are all attributes that I personally would consider integral to 'merit'.
In short, this is a question of who gets to define merit. One of the reasons that democracy is so popular as a political model is that we don't trust each other to see the world as we do, and share our priorities. As such, the popular vote seems like the only 'fair' way to assess the merit of a potential ruler, despite its limitations in that regard.