Pegging - is this a 3 point run?

They played an 8, then I played 7, they played 7, I played 9. Would I get 3 points for the run, or is the 8 buried under the two occurrences of the 7?

3 point run

By definition a run is any 3 cards in order (7,8,9) but not necessarily played in sequence (9,7,8).
You can't derive an order from any three as played - (8,7,7)(7,7,9) so the pair negates the run by burying the 8.
Look on the bright side, tho'...you still scored 31!

8,7,7,9 during play does not

8,7,7,9 during play does not count as run. Like you suggested, the 8 is "buried" under the two 7s.

The sequence is 8-7-7-9 so

The sequence is 8-7-7-9 so the 8 is buried indeed. The last 3 cards would have to make a sequence for you to score 3 points.

But you get 2 points for 31!

Runs

Runs MUST be consecutive cards. Since there were two sevens played, there cannot be a run.