It doesn’t happen often, but it should stand, the rules are very clear on that. Ref is basically an equivalent of a post in this case — whoever took the shot/passed it to him is the goal scorer.Ref scores a goal and it stands. Wonder who went on the score sheet?