U.S. Sen. John McCain (R-Ariz.) didn't win Colorado's Republican primary, but that doesn't preclude him from carrying the state in the general election.
It's happened before, most recently in 1992. Though Bill Clinton lost the state's Democratic primary to Jerry Brown, he went on to win the state in the general election against George H. W. Bush.