We use this expression to sound hopeful after two negative or unlucky experiences。
It seems likely that it is just a folk belief that we ought to persevere and not give up. Three seems to be the right number of times to try. Two isn't enough but four is too many. Think of every time you've seen a drama in which a character tries to unlock a door with an set of unfamiliar keys. The first key fails, the second key fails - it is always the third that works.
A: I've taken my driving test twice before. I failed both times.
B: Third time lucky.
凤凰快3A: I hope so.