What a butt head.

An ex-con was busted for stealing an iPhone when it started ringing — while stashed up his butt in a holding cell at the West Village station house, sources told The Post yesterday.

Trent Patterson, 47, had initially been arrested for allegedly burglarizing the trendy Ted Baker clothing boutique in the Meatpacking District at around 5:50 a.m. Friday, along with four other suspects, the sources said.

A food vendor had spotted the five allegedly going in and out of the shop with armfuls of clothing and accessories. The vendor called cops, and all five suspects were quickly nabbed.

Then, as Patterson was in a holding cell at the Sixth Precinct station house, a 27-year-old man whose iPhone had been swiped used an app to track the device, according to the sources.

The victim, who was at the station house to report the theft, called his phone — and heard the ring coming from Patterson in a nearby cell.

When an officer confronted Patterson, the career criminal admitted that he’d hidden the phone up his butt and retrieved it, the sources said.

Patterson was charged with criminal possession of stolen property for filching the iPhone 5 and burglary for the clothing heist. Patterson has served four stints in state prison dating back to 1991, mostly for robbery. He was being held in lieu of $50,000 bond after his arraignment yesterday in Manhattan Criminal Court.