A turn up for the books
An unexpected piece of good fortune.
Since the 1820s, or thereabouts, the term 'turn-up' has been used to mean 'a surprise; an example of good fortune'. The reference was to cards or dice, which are 'turned up' by chance. Specifically, the 'turn up' was referred to in the game of cribbage. At the start of a game of cribbage a member of one team cuts the pack and a member of the other turns up the top card. If this is a Jack, the second team gets extra points - called 'two for his heels'. Holding the Jack of the suit that is turned up also merits a point - 'one for his nibs', the Jack being one of the 'Royal' cards and 'nibs' being slang for 'a person of importance'.
'Turn up' was defined by John Camden Hotten in 1859, in A Dictionary of Modern Slang, Cant and Vulgar Words:
Turn up: An unexpected slice of luck.
The phrase was originally 'a turn up for the book'. At 18th and 19th century English race meetings, when bets were placed the punter's name and wager were written down in a notebook. Not unreasonably, this process was called 'making a book'. If a race was won by a horse that the 'bookmaker' had no record of in his book, he had a 'turn up' and kept all the wagered money. Camden Hotten was good enough to come to our aid again with his extended definition of 'turn up':
Among sporting men bookmakers are said to have a turn up when an unbacked horse wins.
So, 'a turn up for the book' translates as a stroke of good luck for the bookmakers. The earliest example I can find of the expression in print is from a report, in the Leeds Intelligencer newspaper, of the success of a horse called Blackdown at the Doncaster races in August 1863:
A rare turn-up for the book-makers, the majority of whom had never written Blackdown's name in their books.
See also: turn up trumps.