Merriam-Webster's Dictionary of Synonyms (1984) has an interesting take on this question, in part because it assigns sure to two very different sets of synonyms, only one of which includes confident. First under the grouping led by confident, it has this:
confident, assured, sanguine, sure, presumptuous are comparable as applied to a person or to his temperament, looks, manner, acts, or utterances with the meaning not inhibited by doubts, fears, or a sense of inferiority. Confident may imply a strong belief in oneself or one's powers, but it nearly always implies freedom from fear of failure, frustration, or attack and, as a corollary, certitude of success, fulfillment, or approval. As a rule it is not a depreciative term, and often is complimentary [examples omitted] ... Sure implies that one's freedom from doubts or fears is rather the consequence of certainty or or of complete confidence in one's skills than of temperament or health. The word also often connotes a steady and disciplined mind, mental or emotional stability, or unfailing accuracy [examples omitted]
But sure also shows up in a grouping that it leads:
sure, certain, positive, cocksure mean having or showing no doubt. Sure and certain are often interchangeable. But sure frequently emphasizes the mere subjective state of assurance; certain often suggests more strongly a conviction that is based on definite grounds or on indubitable evidence [examples omitted]
So in Merriam-Webster's telling, confident is closer to an attitude and sure is closer to a conviction. It's noteworthy, too, that MW describes sure as arising out of "complete confidence," as though confident at its highest level yields sure.
S.I. Hayakawa, Choose the Right Word: A Modern Guide to Synonyms (1968) draws an even sharper distinction between confident and sure, parking confident under optimistic, along with hopeful and sanguine, but making sure the lead word of a group that includes certain, definite, doubtless, and positive. Here is Hayakawa's treatment of the two words:
optimistic, confident, hopeful, sanguine These words refer to positive frames of mind. ... Confident, by contrast, stresses conviction and certainty about the future; the word, furthermore, may imply a conviction based on a knowledge of the facts: [examples omitted]. The word may also suggest self-assurance: [example omitted].
sure, certain, definite, doubtless, positive These words all mean free from doubt or uncertainty. Sure and certain are used interchangeably in most contexts, but certain may emphasize the indisputable character of what is referred to, implying that whatever is certain is subject to reasonable debate. Sure is more indiscriminately used. [Examples omitted.] Both words, but especially sure may serve as polite substitutes for a hopeful but less-than-certain attitude. "I'm sure he'll be here on time" can mean "I think (or I hope) he'll be here on time."
I think it's important to bear in mind Hayakawa's observation that people often use sure when they don't mean it. In the example he points to, they do so out of politeness. But people also often use sure (or confident) when they don't mean it, out of a desire to exaggerate or mislead. Ultimately, the breadth of the sliding scale of assuredness or certitude that both confident and sure comprehend dwarfs any fundamental difference in degree of certainty that the two words may have.