Here's my take on what happened...Toms and Boyle were the ringleaders of the plan to switch the confiscated drugs with sugar, and the two cops killed at the beginning were used for the purposes detailed later in the film. Once they served their purpose, Toms most likely convinced Boyle to eliminate them not only to cover their tracks, but also to avoid having to split any of the future drug money sale proceeds with them.
Now unbeknownst to Boyle, Toms was having an affair with Boyle's wife, who later admitted to being estranged with her husband to Wayne's character. After Boyle knocked off the two dirty cops, Toms knocked Boyle off not only to further reduce the eventual overall split, but to also avoid any messy confrontation that would eventually arise when Boyle learned about his wife's affair with Toms. With Boyle and the two other accomplices out of the way, Toms basically had everything to himself, the money, Tom's wife, and not a lot of extraneous links to the crime.