Both sides entered their final match as National League teams in a pulsating final game of the season.