Does this OED citation of "third-rate," and the origin of the idiomatic term, relate to the British Royal Navy?
As mentioned by Steve B in another answer, OED attests the derivation of 'third-rate' (adjective) from a primary source that refers to a British ship in 1649. The same 1649 quote attests the use of 'rate' in the nautical sense III.12.b.:
Any of various classes into which vessels are divided, according (variously, at different times) to the seniority of the captain, the number of guns carried (cf. quot. 1769), complement of crew, or size. Now hist.
Often preceded by an ordinal numeral: cf. first rate n. 1a, second-rate adj., etc.
No earlier attestation is given for 'first rate', 'second rate', etc.
OED is, however, somewhat constrained by its editorial policy regarding the types of sources acceptable; also, the OED selection of attesting quotes is constrained by the necessity of brevity as well as the OED focus on lexical rather than general historicity.
Thus, with regard to lexical historicity, secondary source attestation of the nautical origin of 'third-rate' is available at least as early as February of 1638, in the Calendar of State Papers, Domestic Series, of the Reign of Charles I, 1637-1638, which was edited and published in 1869:
The Convertive, formerly of the second rate, is of late fallen down to the third rate, and has no more allowance of cordage than ships of the third rate.
The rating system "appears for the first time...in 1626", and did not, at the time, "mark any distinction in the force or construction of the ships", at least according to the source cited and excerpted by Wikipedia, W.H. Davenport Adams' 1885 England on the Sea; or, The Story of the British Navy, Its Decisive Battles and Great Commanders. Adams also mentioned the 1626 origin of the rating system in his 1863 Famous Ships of the British Navy.
rate etymonline
First-rate, second-rate, etc. are 1640. From British Navy division of ships into six classes based on size and strength.
and of third: etymonline
Third-rate "of poor quality" is from 1814, ultimately from classification of ships (1640s)
Evidence to suggest yes, related to the Br Navy. 3rd rate meaning 3 decks of cannon.
1728
wiki file and earlier: Henry Grace à Dieu 1514 wikipedia
Henry Grace à Dieu was one of the first vessels to feature gunports and had twenty of the new heavy bronze cannon, allowing for a broadside.
Citation from The Compact Edition of the OED (1971) under third-rate.
1649, Cromwell Let. 4 Nov. in Carlyle. The Garland, one of your third-rate ships, coming happily into Waterford Bay.