We apply the periodized stationary phase method to discrete Wigner functions of systems with odd prime dimension using results from p-adic number theory. We derive the Wigner-Weyl-Moyal (WWM) formalism with higher order corrections representing contextual corrections to noncontextual Clifford operations. We apply this formalism to a subset of unitaries that include diagonal gates such as the π 8 gates. We characterize the stationary phase critical points as a quantum resource injecting contextuality and show that this resource allows for the replacement of the p 2t points that represent t magic state Wigner functions on p-dimensional qudits by ≤ p t points. We find that the π 8 gate introduces the smallest higher order correction possible, requiring the lowest number of additional critical points compared to the Clifford gates. We then establish a relationship between the stabilizer rank of states and the number of critical points necessary to treat them in the WWM formalism. This allows us to exploit the stabilizer rank decomposition of two qutrit π 8 gates to develop a classical strong simulation of a single qutrit marginal on t qutrit π 8 gates that are followed by Clifford evolution, and show that this only requires calculating 3 t 2 +1 critical points corresponding to Gauss sums. This outperforms the best alternative qutrit algorithm (based on Wigner negativity and scaling as ∼3 0.8t for 10 −2 precision) for any number of π 8 gates to full precision.