Thousands of police officers lined the pews Friday at St. Patrick’s Cathedral to honor fallen Officer Jason Rivera, who was gunned down with his partner last week in an ambush that left the New York Police Department in mourning and the city on edge.