A better example might be Stephen Decatur of the USN. He was commissioned a midshipman in 1798 and was promoted to captain in 1804, six years later. His promotion didn't owe to unusual openings above him; neither deaths nor fleet expansion were factors in his promotion. He was advanced for recognized ability in an unusually merit-based organization.
Not so much for ability, which he certainly had, but for a single heroic action. Such "reward" promotions were not too uncommon in those days, though certainly not without controversy. Much resentment was caused by Decatur jumping over seven senior lieutenants (the rank of master commandant [commander] not being in use at the time). One, Andrew Sterett, a very able officer whose Enterprise
captured the first enemy vessel in the Barbary campaign, resigned over the issue.
Even more contentious was the promotion of Charles Morris to captain for being first lieutenant of Constitution
in her victory over Guerriere
. Leapfrogging seven lieutenants and eight masters commandant, Morris's promotion aroused such a furor that it contributed to the resignation of SecNav Hamilton late in 1812.
One must keep in mind that promotion was just about the only way the service could visibly recognize and reward heroism at that time. That function is now ably filled by decorations and medals, and pretty much no one wants to go back to using promotions in that way.