Marcus Thuram and Denzel Dumfries each scored twice as Inter Milan came back from two goals down and won 4-3 in the thrilling match.