ANSWER: In order to answer your question regarding this curse we need to look at the context of the different statements. In the case of the Apostle Paul, he is in front of Jewish religious leaders stating he has lived his life with a clear conscience. The High Priest at the time, Ananias, orders someone standing near him to slap him in the face (maybe because they thought he was lying?). The response of Paul, which was to curse the priest, was immediate and blunt. He stated, "'God will certainly strike you - you whitewashed (whited) wall!" (Acts 23:3).
The reason Paul repented is that part of what he said to the high priest was against the law. But it was not the part about calling the high priest a "whited wall" or "whitewashed wall" that was wrong. What was wrong was him asking God to smite or strike the high priest. That was the "curse" against a leader that he repented of.
The commandment not to curse "the ruler" of the Israelites was a part of the Old Covenant (Exodus 22:28), which Paul was well aware of. What contemporary readers may not understand is the reference to the high priest as a "whited wall".
In the first century indoor plumbing was quite scarce. There were, however, designated areas where the public could urinate. Usually these incorporated a wall with a drain at its base that would allow the urine to drain to an appropriate area and the wall itself diminished the splashing that often occurs when urinating. In order to minimize the smell these walls were "dusted" (the Hebrew word koniao translated as "whitened" actually refers to spreading lime dust, which is still used in outdoor toilets in many areas), which is also called "whited" or "whitewashed". While referring to someone as a wall upon which the public urinated could be considered vulgar, it was not a "curse" per se.
Paul reacted in pain and anger to his being struck. As a student of the law he knew that the law forbade punishing anyone before their guilt had been established in the testimony of two or more witnesses. Yet that did not excuse his curse of the man, even though he did not know that he was the high priest (Acts 23:5).
Jesus' comments were not made to the "ruler of the people" but to the Pharisees. Furthermore, He pronounced no curse of any kind. He was calling their hypocrisy to account and used the analogy of "whited sepulchers" or "whitewashed tombs" (Matthew 23:25-28).
The only connection between Jesus' statement and Paul's is the use of the term "whited" or "whitewashed." Jesus was speaking of tombs, which were often dusted with lime (whitewashed) to keep down the smell. Furthermore, he was not calling the Pharisees whitewashed tombs but saying they were "like" whitewashed tombs. He used a perfect analogy to describe the hypocrisy of the Pharisees and explained the analogy to them without cursing them in any respect.
By digging a little deeper we have found no contradiction between the statement made by the two men. Yes, Paul did curse the high priest, but it was asking God to condemn him that was the problem.