Well actually it is possible...
gxf6 Kh7
Kg5 Kh8
f7 Kh7
f8=Q
Assuming it's Black to move, which is not specified by the OP, it's mate in five as MaxFlaggedYou pointed out. White's mating sequence is significantly longer.
It's mate in five with Black to move. Your variation does not work for a couple of reasons. The position reached after 1... Qf3 2. g6 Kg7 3. g5 Kxg6 is a draw by stalemate. Additionally, White's best reply to 2... Kg7 is 3. Kg5 ..., not 3. g5 ...
I couldn't actually find a solution to this puzzle.
The rule is simple:
Mate in 3 moves
It's quite possible with 4 moves, but here 3 moves only...