Sounds like you turned one gear tooth too many? Wrong Way? There is nothing to be lost, IMHO, by turning it in the opposite way, a little trial and error here can't make it worse. BTW, I bought a little CDROMZZ from an eBay seller called 'biddy-biddy,' I think...it has all the manuals, parts diagrams for all the Canon digicams, @ least that was the claim...It certainly had what I wanted re my s400. I would research it for you, but I loaned it out.
While I am sure the info on the CD is available on the web, having what I wanted in one place was worth the under 10 bucks I paid. )no affiliation, just happy customer.)
Anyhoo, back to your 510, I would gingerly twist the barrel to pop it back to correct position, your out of focus status is easily a diagnostic point of differentiation. hat double click you hear has to be a gear turning to its desired position, but the other gear it meshes with has already reached itsmax ability to travel, hence the clicks. One tooth too many, in the wrong direction....2 clicks? Make sense?
Good Luck!
gUMP