England became the first team in first-class cricket, let alone Tests, to concede five centuries in a game and win.