Short answer: It was an unresolved ko situation during scoring. technically we do not know who owns the corner. Therefore the scoring process was premature – the ko fight should have been finished first before scoring.
The explanation:
You have just encountered the dirtiest tactic in Go. It is what makes professionals sweat; it is what makes Go, Go.
The Ko rule is perhaps one of the most confusing thing for a beginner to learn. Have no fear, Issho is here.
What is Ko?
I’m a visual learner, so I produced some explanations in my trusty QiPan editor. Excuse the shameless self promotion
Ko fight happens when a stone can be captured back and forth:
If you imagine this kind of situation happening at a critical area on the board, neither players are willing to give up the stone. Then the problem becomes: WHEN WILL THIS EVER END??!
Here’s where the Ko rule comes in. Essentially after one player has captured the stone in the centre, the other player cannot capture immediately. He has to play elsewhere first for his next turn, before recapturing (if it is still available).
This gif illustrate everything (ignore black and white dots):
See how both players had to play elsewhere for the ‘recapture’ to continue? Either player may choose to end the ko fight by filling in the gap to prevent capture. That essentially ends a ko fight.
I’m not going to go in depth about ko threats, but just know this: You have 1 move to play elsewhere. If you want to makes this fight continue, make that move count. Play somewhere that your opponent feel like he has to respond to, instead of filling in this gap. That’s the essence of a ko fight. (Again, extremely simplified).
Ko can happen around the edge of the board too:
In your case, this is the kind of ko you will face:
Put into the context of your own game. The three triangled area marks the stage of your unresolved ko fight:
Let’s suppose white plays at the empty square (marked triangle) and begins the ko fight:
Black is in tough waters. There are no ko threats to continue this ko fight. I am not going to try to confuse you with ‘what is a ko threat’ (I’ll kindly refer to @Adam3141’s link to sensei’s library page.) I just want to show you how the board situation might end up if either side wins the ko:
Situation 1: white wins ko
White just needs 1 more move to kill black stones (marked with a circle). If black cannot cause enough ruckus on the board to distract white from doing so (which is most likely what will happen) then black will lose all those stones.
Situation 2: black wins ko
This is tough for black since black needs to kill two white stones to settle his position. If black wins the ko, then black will have a living corner with two eyes:
So did you win or lose the game? It’s the Shrödinger cat problem. The ko fight is an uncertainty, you could win or you could lose, depending on the outcome of this fight. Until then, consider yourself won and lost at the same time? XD
P.S. Black won’t have enough ko threats in the endgame. Likely white has won the game