Congratulations, you found an inverted pyramid ice spike, sometimes called an ice vase!
The Bally-Dorsey model of how it happens is that first the surface of the water freezes, sealing off the water below except for a small opening. If the freezing rate is high enough the expansion of ice under the surface will increase pressure (since the ice is less dense than the water and displaces more volume), and this forces water up through the opening, where it will freeze around the rim. As the process goes on a spike emerges.
If the initial opening or the crystal planes near it are aligned in the right way the result is a pyramid rather than a cylinder/spike.
The process is affected by impurities, the water has to be fairly clean. It also requires fairly low temperatures so freezing is fast enough (but not too fast).