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 (Acts 23:1).
After hearing Paul's statement the High Priest, Ananias, orders someone standing near him to slap him in the face (maybe because they thought he was lying?). The quick response of the apostle was a condemnation directed at the priest. He bluntly stated, "God is about to strike you, you whited wall . . ." (Acts 23:3).
The reason Paul immediately repented of what he did (Acts 23:5) is that part of it was against God's law. It was not wrong, per se, to call someone a "whited wall" or "whitewashed wall." It was a sin, however, to ask God to smite or strike Israel's High Priest (Exodus 22:28). He was unaware that the person who commanded he be struck was the religious leader of the people that year.
The commandment not to put down "the ruler" of the Israelites was a part of the Old Covenant, 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 strictly condemning a person before God.
Paul reacted in pain and anger to being struck. As a student of the law he knew it forbade punishing anyone before their guilt had been established in the testimony of two or more witnesses. That did not, however, excuse his impulsive words toward this special person.
In comparison, the Lord's criticisms were never directed specifically toward the "ruler of the people" but targeted the Pharisees and other religious leaders. Furthermore, He never pronounced a curse. When he called the Pharisees "whited sepulchers" he was rightly labeling their hypocrisy (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 showing them disrespect.
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.